public void update(Object value,boolean forceToDisk) throws IOException {
  if (log == null) {
    throw new LogException("log file for persistent state is " + "inaccessible, it may have been " + "corrupted or closed");
  }
  try {
    handler.writeUpdate(new LogOutputStream(log),value);
  }
 catch (  Exception e) {
    throw new LogException("write update failed",e);
  }
  if (forceToDisk) {
    try {
      logFD.sync();
    }
 catch (    SyncFailedException sfe) {
      throw new LogException("sync log failed",sfe);
    }
  }
  long entryEnd=log.getFilePointer();
  long updateLen=entryEnd - logBytes - intBytes;
  if (updateLen > Integer.MAX_VALUE) {
    throw new LogException("maximum record length exceeded");
  }
  log.seek(logBytes);
  writeInt(log,(int)updateLen);
  if (format == FORMAT_PADDED) {
    entryEnd=(entryEnd + 3) & ~3L;
  }
  log.seek(entryEnd);
  log.write(zeroBuf);
  logBytes=entryEnd;
  if (forceToDisk) {
    try {
      logFD.sync();
    }
 catch (    SyncFailedException sfe) {
      throw new LogException("sync log failed",sfe);
    }
  }
}

public void update ( Object value , boolean forceToDisk ) throws IOException { if ( log == null ) { throw new LogException ( "log file for persistent state is " + "inaccessible, it may have been " + "corrupted or closed" ) ; } try { handler . writeUpdate ( new LogOutputStream ( log ) , value ) ; } catch ( Exception e ) { throw new LogException ( "write update failed" , e ) ; } if ( forceToDisk ) { try { logFD . sync ( ) ; } catch ( SyncFailedException sfe ) { throw new LogException ( "sync log failed" , sfe ) ; } } long entryEnd = log . getFilePointer ( ) ; long updateLen = entryEnd - logBytes - intBytes ; if ( updateLen > Integer . MAX_VALUE ) { throw new LogException ( "maximum record length exceeded" ) ; } log . seek ( logBytes ) ; writeInt ( log , ( int ) updateLen ) ; if ( format == FORMAT_PADDED ) { entryEnd = ( entryEnd + 3 ) & ~ 3L ; } log . seek ( entryEnd ) ; log . write ( zeroBuf ) ; logBytes = entryEnd ; if ( forceToDisk ) { try { logFD . sync ( ) ; } catch ( SyncFailedException sfe ) { throw new LogException ( "sync log failed" , sfe ) ; } } }
records this update in the log file and optionally forces the update to disk . the update is recorded by calling the client ' s writeupdate callback . this method must not be called until this log ' s recover method has been invoked ( and completed ) .
