public abstract class

LogHandler

extends Object
java.lang.Object
   ↳ sun.rmi.log.LogHandler

Class Overview

A LogHandler represents snapshots and update records as serializable objects. This implementation does not know how to create an initial snaphot or apply an update to a snapshot. The client must specifiy these methods via a subclass.

See Also

Summary

Public Constructors
LogHandler()
Creates a LogHandler for a ReliableLog.
Public Methods
abstract Object applyUpdate(Object update, Object state)
Reads a stably logged update (a serializable object) from a stream.
abstract Object initialSnapshot()
Creates and returns the initial state of data structure that needs to be stably stored.
Object readUpdate(LogInputStream in, Object state)
Reads a stably logged update (a serializable object) from a stream.
Object recover(InputStream in)
Read the snapshot object from a stream and returns the snapshot.
void snapshot(OutputStream out, Object value)
Writes the snapshot object to a stream.
void writeUpdate(LogOutputStream out, Object value)
Writes the representation (a serializable object) of an update to a stream.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LogHandler ()

Creates a LogHandler for a ReliableLog.

Public Methods

public abstract Object applyUpdate (Object update, Object state)

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 is invoked in order to obtain the new snapshot value. The method should apply the update object to the current state state and return the new state (the new snapshot value).

Parameters
update the update object
state the current state
Returns
  • the new state
Throws
Exception can raise any exception

public abstract Object initialSnapshot ()

Creates and returns the initial state of data structure that needs to be stably stored. This method is called when a ReliableLog is created.

Returns
  • the initial state
Throws
Exception can raise any exception

public Object readUpdate (LogInputStream in, Object state)

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.

Parameters
in the input stream
state the current state
Returns
  • the new state
Throws
Exception can raise any exception

public Object recover (InputStream in)

Read the snapshot object from a stream and returns the snapshot. This callback is invoked when the client calls the recover method of ReliableLog.

Parameters
in the input stream
Returns
  • the state (snapshot)
Throws
Exception can raise any exception

public void snapshot (OutputStream out, Object value)

Writes the snapshot object to a stream. This callback is invoked when the client calls the snaphot method of ReliableLog.

Parameters
out the output stream
value the snapshot
Throws
Exception can raise any exception

public void writeUpdate (LogOutputStream out, Object value)

Writes the representation (a serializable object) of an update to a stream. This callback is invoked when the client calls the update method of ReliableLog.

Parameters
out the output stream
value the snapshot
Throws
Exception can raise any exception