@Override public synchronized void close() throws SQLException {
  try {
    debugCodeCall("close");
    if (session == null) {
      return;
    }
    CloseWatcher.unregister(watcher);
    session.cancel();
    if (executingStatement != null) {
      try {
        executingStatement.cancel();
      }
 catch (      NullPointerException e) {
      }
    }
synchronized (session) {
      try {
        if (!session.isClosed()) {
          try {
            if (session.hasPendingTransaction()) {
              if (!session.isReconnectNeeded(true)) {
                try {
                  rollbackInternal();
                }
 catch (                DbException e) {
                  if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) {
                    throw e;
                  }
                }
              }
              session.afterWriting();
            }
            closePreparedCommands();
          }
  finally {
            session.close();
          }
        }
      }
  finally {
        session=null;
      }
    }
  }
 catch (  Exception e) {
    throw logAndConvert(e);
  }
}

@ Override public synchronized void close ( ) throws SQLException { try { debugCodeCall ( "close" ) ; if ( session == null ) { return ; } CloseWatcher . unregister ( watcher ) ; session . cancel ( ) ; if ( executingStatement != null ) { try { executingStatement . cancel ( ) ; } catch ( NullPointerException e ) { } } synchronized ( session ) { try { if ( ! session . isClosed ( ) ) { try { if ( session . hasPendingTransaction ( ) ) { if ( ! session . isReconnectNeeded ( true ) ) { try { rollbackInternal ( ) ; } catch ( DbException e ) { if ( e . getErrorCode ( ) != ErrorCode . CONNECTION_BROKEN_1 ) { throw e ; } } } session . afterWriting ( ) ; } closePreparedCommands ( ) ; } finally { session . close ( ) ; } } } finally { session = null ; } } } catch ( Exception e ) { throw logAndConvert ( e ) ; } }
closes this connection . all open statements , prepared statements and result sets that where created by this connection become invalid after calling this method . if there is an uncommitted transaction , it will be rolled back .
