Exemplo n.º 1
0
 /**
  * Reads a stably logged update (a serializable object) from a stream. This callback is invoked
  * during recovery, once for every record in the log. After reading the update, this method
  * invokes the applyUpdate (abstract) method in order to obtain the new snapshot value. It then
  * returns the new snapshot.
  *
  * @param in the input stream
  * @param state the current state
  * @return the new state
  * @exception Exception can raise any exception
  */
 public Object readUpdate(LogInputStream in, Object state) throws Exception {
   MarshalInputStream s = new MarshalInputStream(in);
   return applyUpdate(s.readObject(), state);
 }
Exemplo n.º 2
0
 /**
  * Read the snapshot object from a stream and returns the snapshot. This callback is invoked when
  * the client calls the recover method of ReliableLog.
  *
  * @param in the input stream
  * @return the state (snapshot)
  * @exception Exception can raise any exception
  */
 public Object recover(InputStream in) throws Exception {
   MarshalInputStream s = new MarshalInputStream(in);
   return s.readObject();
 }