private boolean autoReconnect(int count){
  if (!isClosed()) {
    return false;
  }
  if (!autoReconnect) {
    return false;
  }
  if (!cluster && !autoCommit) {
    return false;
  }
  if (count > SysProperties.MAX_RECONNECT) {
    return false;
  }
  lastReconnect++;
  while (true) {
    try {
      embedded=connectEmbeddedOrServer(false);
      break;
    }
 catch (    DbException e) {
      if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) {
        throw e;
      }
      try {
        Thread.sleep(500);
      }
 catch (      Exception e2) {
      }
    }
  }
  if (embedded == this) {
    embedded=null;
  }
 else {
    connectEmbeddedOrServer(true);
  }
  recreateSessionState();
  if (eventListener != null) {
    eventListener.setProgress(DatabaseEventListener.STATE_RECONNECTED,databaseName,count,SysProperties.MAX_RECONNECT);
  }
  return true;
}

private boolean autoReconnect ( int count ) { if ( ! isClosed ( ) ) { return false ; } if ( ! autoReconnect ) { return false ; } if ( ! cluster && ! autoCommit ) { return false ; } if ( count > SysProperties . MAX_RECONNECT ) { return false ; } lastReconnect ++ ; while ( true ) { try { embedded = connectEmbeddedOrServer ( false ) ; break ; } catch ( DbException e ) { if ( e . getErrorCode ( ) != ErrorCode . DATABASE_IS_IN_EXCLUSIVE_MODE ) { throw e ; } try { Thread . sleep ( 500 ) ; } catch ( Exception e2 ) { } } } if ( embedded == this ) { embedded = null ; } else { connectEmbeddedOrServer ( true ) ; } recreateSessionState ( ) ; if ( eventListener != null ) { eventListener . setProgress ( DatabaseEventListener . STATE_RECONNECTED , databaseName , count , SysProperties . MAX_RECONNECT ) ; } return true ; }
automatically re - connect if necessary and if configured to do so .
