Source:
<code>static void shutdownGraphDatabaseService(GraphDatabaseService neo4jDb) { GraphDatabaseAPI sq = (GraphDatabaseAPI) neo4jDb; String key = sq.getStoreDir().getAbsolutePath(); if ( GRAPH_DATABASE_SERVICE_MAP.containsKey( key ) ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.get( key ); factoryHolder.setCounter( factoryHolder.getCounter() - 1 ); LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), key ); GraphDatabaseFacade graphDatabaseFacade = factoryHolder.getGraphDatabaseFacade(); try { GraphDatabaseFacade.SPI spi = null; Object obj = getPrivateField( GraphDatabaseFacade.class.getDeclaredField( "spi" ), graphDatabaseFacade ); spi = (GraphDatabaseFacade.SPI) obj; LOG.debugf( " isInOpenTransaction: %s", spi.isInOpenTransaction() ); if ( spi.isInOpenTransaction() ) { LOG.warnf( "currentTransaction: %s", spi.currentTransaction() ); LOG.warnf( "transaction started %s", spi.currentTransaction().startTime() ); LOG.warn( "hang transactions will commited and closed .." ); <START> spi.currentTransaction().success(); <END> spi.currentTransaction().closeTransaction(); } } catch ( IllegalAccessException | NoSuchFieldException e) { throw new HibernateException( "Can't get value of private variable by reflection!",e ); } catch (TransactionFailureException e) { throw new HibernateException( "Can't close transaction!",e ); } if ( factoryHolder.getCounter() == 0 ) { LOG.debugf( " Shutdown db for path : %s", key ); factoryHolder.getGraphDatabaseFacade().shutdown(); GRAPH_DATABASE_SERVICE_MAP.remove( key ); } } } else { throw LOG.unknownDatabasePathException( key ); } }</code><technical_language>This code is closing a transaction factory is shut down. coimmitting a transaction hood a user knowing it. if transaction is supposed rolled else needs done for user workflow correct? transaction in a failure() state resetting success(). I mean, missing this correct</technical_language>

Target:
static void shutdownGraphDatabaseService(GraphDatabaseService neo4jDb) { GraphDatabaseAPI sq = (GraphDatabaseAPI) neo4jDb; String key = sq.getStoreDir().getAbsolutePath(); if ( GRAPH_DATABASE_SERVICE_MAP.containsKey( key ) ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.get( key ); factoryHolder.setCounter( factoryHolder.getCounter() - 1 ); LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), key ); GraphDatabaseFacade graphDatabaseFacade = factoryHolder.getGraphDatabaseFacade(); try { GraphDatabaseFacade.SPI spi = null; Object obj = getPrivateField( GraphDatabaseFacade.class.getDeclaredField( "spi" ), graphDatabaseFacade ); spi = (GraphDatabaseFacade.SPI) obj; LOG.debugf( " isInOpenTransaction: %s", spi.isInOpenTransaction() ); if ( spi.isInOpenTransaction() ) { LOG.warnf( "currentTransaction: %s", spi.currentTransaction() ); LOG.warnf( "transaction started %s", spi.currentTransaction().startTime() ); spi.currentTransaction().failure(); spi.currentTransaction().closeTransaction(); throw LOG.existsOpenTransactionsFornDatabasePathException( key ); } } catch ( IllegalAccessException | NoSuchFieldException e) { throw new HibernateException( "Can't get value of private variable by reflection!",e ); } catch (TransactionFailureException e) { throw new HibernateException( "Can't close transction!",e ); } if ( factoryHolder.getCounter() == 0 ) { LOG.debugf( " Shutdown db for path : %s", key ); factoryHolder.getGraphDatabaseFacade().shutdown(); GRAPH_DATABASE_SERVICE_MAP.remove( key ); } } } else { throw LOG.unknownDatabasePathException( key ); } }