public void close ( String line , DispatchCallback callback ) { // close file writer if ( sqlLine . getRecordOutputFile ( ) != null ) { // instead of line could be any string stopRecording ( line , callback ) ; } DatabaseConnection databaseConnection = sqlLine . getDatabaseConnection ( ) ; if ( databaseConnection == null ) { callback . setToFailure ( ) ; return ; } try { Connection connection = databaseConnection . getConnection ( ) ; if ( connection != null && ! connection . isClosed ( ) ) { sqlLine . info ( sqlLine . loc ( "closing" , connection . getClass ( ) . getName ( ) ) ) ; connection . close ( ) ; } else { sqlLine . info ( sqlLine . loc ( "already-closed" ) ) ; } } catch ( Exception e ) { callback . setToFailure ( ) ; sqlLine . error ( e ) ; return ; } sqlLine . getDatabaseConnections ( ) . remove ( ) ; callback . setToSuccess ( ) ; }
Closes the current connection . Closes the current file writer .