private synchronized boolean reconnectModified(boolean pending){
  if (readOnly || lock == null || fileLockMethod != FileLock.LOCK_SERIALIZED) {
    return true;
  }
  try {
    if (pending == reconnectChangePending) {
      long now=System.currentTimeMillis();
      if (now > reconnectCheckNext) {
        if (pending) {
          String pos=pageStore == null ? null : "" + pageStore.getWriteCountTotal();
          lock.setProperty("logPos",pos);
          lock.save();
        }
        reconnectCheckNext=now + reconnectCheckDelay;
      }
      return true;
    }
    Properties old=lock.load();
    if (pending) {
      if (old.getProperty("changePending") != null) {
        return false;
      }
      trace.debug("wait before writing");
      Thread.sleep((int)(reconnectCheckDelay * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
    String pos=pageStore == null ? null : "" + pageStore.getWriteCountTotal();
    lock.setProperty("logPos",pos);
    if (pending) {
      lock.setProperty("changePending","true-" + Math.random());
    }
 else {
      lock.setProperty("changePending",null);
    }
    reconnectCheckNext=System.currentTimeMillis() + 2 * reconnectCheckDelay;
    old=lock.save();
    if (pending) {
      trace.debug("wait before writing again");
      Thread.sleep((int)(reconnectCheckDelay * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
 else {
      Thread.sleep(1);
    }
    reconnectLastLock=old;
    reconnectChangePending=pending;
    reconnectCheckNext=System.currentTimeMillis() + reconnectCheckDelay;
    return true;
  }
 catch (  Exception e) {
    trace.error(e,"pending {0}",pending);
    return false;
  }
}

private synchronized boolean reconnectModified ( boolean pending ) { if ( readOnly || lock == null || fileLockMethod != FileLock . LOCK_SERIALIZED ) { return true ; } try { if ( pending == reconnectChangePending ) { long now = System . currentTimeMillis ( ) ; if ( now > reconnectCheckNext ) { if ( pending ) { String pos = pageStore == null ? null : "" + pageStore . getWriteCountTotal ( ) ; lock . setProperty ( "logPos" , pos ) ; lock . save ( ) ; } reconnectCheckNext = now + reconnectCheckDelay ; } return true ; } Properties old = lock . load ( ) ; if ( pending ) { if ( old . getProperty ( "changePending" ) != null ) { return false ; } trace . debug ( "wait before writing" ) ; Thread . sleep ( ( int ) ( reconnectCheckDelay * 1.1 ) ) ; Properties now = lock . load ( ) ; if ( ! now . equals ( old ) ) { return false ; } } String pos = pageStore == null ? null : "" + pageStore . getWriteCountTotal ( ) ; lock . setProperty ( "logPos" , pos ) ; if ( pending ) { lock . setProperty ( "changePending" , "true-" + Math . random ( ) ) ; } else { lock . setProperty ( "changePending" , null ) ; } reconnectCheckNext = System . currentTimeMillis ( ) + 2 * reconnectCheckDelay ; old = lock . save ( ) ; if ( pending ) { trace . debug ( "wait before writing again" ) ; Thread . sleep ( ( int ) ( reconnectCheckDelay * 1.1 ) ) ; Properties now = lock . load ( ) ; if ( ! now . equals ( old ) ) { return false ; } } else { Thread . sleep ( 1 ) ; } reconnectLastLock = old ; reconnectChangePending = pending ; reconnectCheckNext = System . currentTimeMillis ( ) + reconnectCheckDelay ; return true ; } catch ( Exception e ) { trace . error ( e , "pending {0}" , pending ) ; return false ; } }
set or reset the pending change flag in the . lock . db file .
