public void shutdown ( boolean closeDb , boolean commitTx ) { makeActive ( ) ; try { if ( ! isClosed ( ) ) { if ( commitTx ) { final OStorage storage = getDatabase ( ) . getStorage ( ) . getUnderlying ( ) ; if ( storage instanceof OAbstractPaginatedStorage ) { if ( ( ( OAbstractPaginatedStorage ) storage ) . getWALInstance ( ) != null ) getDatabase ( ) . commit ( ) ; } else { getDatabase ( ) . commit ( ) ; } } else if ( closeDb ) { getDatabase ( ) . rollback ( ) ; } } } catch ( ONeedRetryException e ) { throw e ; } catch ( RuntimeException e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; throw e ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; throw OException . wrapException ( new ODatabaseException ( "Error during context close for db " + url ) , e ) ; } finally { try { if ( closeDb ) { getDatabase ( ) . close ( ) ; if ( getDatabase ( ) . isPooled ( ) ) { database = null ; } } pollGraphFromStack ( closeDb ) ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; } } url = null ; username = null ; password = null ; if ( ! closeDb ) getDatabase ( ) . activateOnCurrentThread ( ) ; }
Closes the Graph . After closing the Graph cannot be used .