public boolean isReconnectNeeded(){
  if (fileLockMethod != FileLock.LOCK_SERIALIZED) {
    return false;
  }
  if (reconnectChangePending) {
    return false;
  }
  long now=System.currentTimeMillis();
  if (now < reconnectCheckNext) {
    return false;
  }
  reconnectCheckNext=now + reconnectCheckDelay;
  if (lock == null) {
    lock=new FileLock(traceSystem,databaseName + Constants.SUFFIX_LOCK_FILE,Constants.LOCK_SLEEP);
  }
  try {
    Properties prop=lock.load(), first=prop;
    while (true) {
      if (prop.equals(reconnectLastLock)) {
        return false;
      }
      if (prop.getProperty("changePending",null) == null) {
        break;
      }
      if (System.currentTimeMillis() > now + reconnectCheckDelay * 10) {
        if (first.equals(prop)) {
          lock.setProperty("changePending",null);
          lock.save();
          break;
        }
      }
      trace.debug("delay (change pending)");
      Thread.sleep(reconnectCheckDelay);
      prop=lock.load();
    }
    reconnectLastLock=prop;
  }
 catch (  Exception e) {
    trace.error(e,"readOnly {0}",readOnly);
  }
  return true;
}

public boolean isReconnectNeeded ( ) { if ( fileLockMethod != FileLock . LOCK_SERIALIZED ) { return false ; } if ( reconnectChangePending ) { return false ; } long now = System . currentTimeMillis ( ) ; if ( now < reconnectCheckNext ) { return false ; } reconnectCheckNext = now + reconnectCheckDelay ; if ( lock == null ) { lock = new FileLock ( traceSystem , databaseName + Constants . SUFFIX_LOCK_FILE , Constants . LOCK_SLEEP ) ; } try { Properties prop = lock . load ( ) , first = prop ; while ( true ) { if ( prop . equals ( reconnectLastLock ) ) { return false ; } if ( prop . getProperty ( "changePending" , null ) == null ) { break ; } if ( System . currentTimeMillis ( ) > now + reconnectCheckDelay * 10 ) { if ( first . equals ( prop ) ) { lock . setProperty ( "changePending" , null ) ; lock . save ( ) ; break ; } } trace . debug ( "delay (change pending)" ) ; Thread . sleep ( reconnectCheckDelay ) ; prop = lock . load ( ) ; } reconnectLastLock = prop ; } catch ( Exception e ) { trace . error ( e , "readOnly {0}" , readOnly ) ; } return true ; }
check if the contents of the database was changed and therefore it is required to re - connect . this method waits until pending changes are completed . if a pending change takes too long ( more than 2 seconds ) , the pending change is broken ( removed from the properties file ) .
