| java.lang.Object org.prevayler.implementation.SnapshotPrevayler
SnapshotPrevayler | public class SnapshotPrevayler implements Prevayler(Code) | | Provides transparent persistence for business objects.
This applies to any deterministic system implementing the PrevalentSystem interface.
All commands to the system must be represented as objects implementing the Command interface and must be executed using Prevayler.executeCommand(Command).
Take a look at the demo application included with the Prevayler distribution for examples.
|
Method Summary | |
public synchronized Serializable | executeCommand(Command command) Logs the received command for crash or shutdown recovery and executes it on the underlying PrevalentSystem. | public PrevalentSystem | system() Returns the underlying PrevalentSystem. | public synchronized void | takeSnapshot() Produces a complete serialized image of the underlying PrevalentSystem.
This will accelerate future system startups. |
SnapshotPrevayler | public SnapshotPrevayler(PrevalentSystem newSystem) throws IOException, ClassNotFoundException(Code) | | Returns a new Prevayler for the given PrevalentSystem.
"PrevalenceBase" shall be the directory where the snapshot and log files shall be created and read.
Parameters: newSystem - The newly started, "empty" PrevalentSystem that will be used as a starting point for every system startup, until the first snapshot is taken. |
SnapshotPrevayler | public SnapshotPrevayler(PrevalentSystem newSystem, String directory) throws IOException, ClassNotFoundException(Code) | | Returns a new Prevayler for the given PrevalentSystem.
Parameters: newSystem - The newly started, "empty" PrevalentSystem that will be used as a starting point for every system startup, until the first snapshot is taken. Parameters: directory - The full path of the directory where the snapshot and log files shall be created and read. |
executeCommand | public synchronized Serializable executeCommand(Command command) throws Throwable(Code) | | Logs the received command for crash or shutdown recovery and executes it on the underlying PrevalentSystem.
See Also: system() The serializable object that was returned by the execution of command. throws: IOException - if there is trouble writing the command to the log. throws: Exception - if command.execute() throws an exception. |
takeSnapshot | public synchronized void takeSnapshot() throws IOException(Code) | | Produces a complete serialized image of the underlying PrevalentSystem.
This will accelerate future system startups. Taking a snapshot once a day is enough for most applications.
See Also: system() throws: IOException - if there is trouble writing to the snapshot file. |
|
|