APIdia Launch Partner
Top Description Constructors Methods
sun.rmi.log

public abstract Class LogHandler

extends Object
Class Inheritance
Imports
java.io.*, sun.rmi.server.MarshalOutputStream, .MarshalInputStream

A LogHandler represents snapshots and update records as serializable objects. This implementation does not know how to create an initial snapshot or apply an update to a snapshot. The client must specify these methods via a subclass.
Author
Ann Wollrath
See Also
ReliableLog

Constructor Summary

AccessConstructor and Description
public
LogHandler()

Creates a LogHandler for a ReliableLog.

Method Summary

Modifier and TypeMethod and Description
public abstract Object

Returns:

the new state
applyUpdate
(Object
the update object
update
,
Object
the current state
state
)

Reads a stably logged update (a serializable object) from a stream.

public abstract Object

Returns:

the initial state
initialSnapshot
()

Creates and returns the initial state of data structure that needs to be stably stored.

public Object

Returns:

the new state
readUpdate
(LogInputStream
the input stream
in
,
Object
the current state
state
)

Reads a stably logged update (a serializable object) from a stream.

public Object

Returns:

the state (snapshot)
recover
(InputStream
the input stream
in
)

Read the snapshot object from a stream and returns the snapshot.

public void
snapshot(OutputStream
the output stream
out
,
Object
the snapshot
value
)

Writes the snapshot object to a stream.

public void
writeUpdate(LogOutputStream
the output stream
out
,
Object
the snapshot
value
)

Writes the representation (a serializable object) of an update to a stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LogHandlerback to summary
public LogHandler()

Creates a LogHandler for a ReliableLog.

Method Detail

applyUpdateback to summary
public abstract Object applyUpdate(Object update, Object state) throws Exception

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:Object

the update object

state:Object

the current state

Returns:Object

the new state

Exceptions
Exception:
can raise any exception
initialSnapshotback to summary
public abstract Object initialSnapshot() throws Exception

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:Object

the initial state

Exceptions
Exception:
can raise any exception
readUpdateback to summary
public Object readUpdate(LogInputStream in, Object state) throws Exception

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:LogInputStream

the input stream

state:Object

the current state

Returns:Object

the new state

Exceptions
Exception:
can raise any exception
recoverback to summary
public Object recover(InputStream in) throws Exception

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:InputStream

the input stream

Returns:Object

the state (snapshot)

Exceptions
Exception:
can raise any exception
snapshotback to summary
public void snapshot(OutputStream out, Object value) throws Exception

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

Parameters
out:OutputStream

the output stream

value:Object

the snapshot

Exceptions
Exception:
can raise any exception
writeUpdateback to summary
public void writeUpdate(LogOutputStream out, Object value) throws Exception

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:LogOutputStream

the output stream

value:Object

the snapshot

Exceptions
Exception:
can raise any exception