All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ninja.xset.RecoveryMgr

java.lang.Object
   |
   +----ninja.xset.RecoveryMgr

public class RecoveryMgr
extends Object
Class RecoveryMgr ** Class that does checkpointing and recovery for the XSetService It offers methods to for initial startup recovery, as well as immediate synchronous checkpointing.


Variable Index

 o ckptFileName
File and directory name constants
 o dataDirName
 o logExtension

Constructor Index

 o RecoveryMgr(String, int)
RecoveryMgr(String, int) ** The constructor for Recovery Manager

Method Index

 o checkpoint(SETserver)
boolean checkpoint(SETserver) ** method to do a current checkpoint of the SETserver object Need to call into a synchronized function in SETserver

The serialization sequence of the object stream is:
1.

 o forceSync()
void forceSync() ** method to force a synchronous write out to disk of the log buffer
 o makeLogEntry(int, long, int)
String makeLogEntry(int logType, long sequenceID) ** Method to produce a String formatted log entry based on arguments passed in.
Current arguments include logtype and sequenceID of the document.
 o restore()
SETserver restore() ** The method that is called at startup to restore the previous checkpoint contents.
 o writeLog(String)
void writeLog(String) * Method that appends a log entry to the log buffer.

Variables

 o ckptFileName
 public static final String ckptFileName
File and directory name constants

 o dataDirName
 public static final String dataDirName
 o logExtension
 public static final String logExtension

Constructors

 o RecoveryMgr
 public RecoveryMgr(String dir,
                    int bufSize) throws RecoveryException
RecoveryMgr(String, int) ** The constructor for Recovery Manager

Parameters:
dir - - The directory that checkpoint and logs are stored in
bufSize - - The # of logs before buffer is sync'd to disk
Throws: RecoveryException
when buffersize is out of range

Methods

 o writeLog
 public void writeLog(String newlog) throws CheckpointException
void writeLog(String) * Method that appends a log entry to the log buffer. The buffer will be emptied when it reaches a certain size, or when explicitly forced

Parameters:
String - that contains the new log entry
Throws: CheckpointException
if the log file sync fails
 o forceSync
 public void forceSync() throws CheckpointException
void forceSync() ** method to force a synchronous write out to disk of the log buffer

Throws: CheckpointException
if the log file sync fails
 o checkpoint
 public boolean checkpoint(SETserver set) throws CheckpointException
boolean checkpoint(SETserver) ** method to do a current checkpoint of the SETserver object Need to call into a synchronized function in SETserver

The serialization sequence of the object stream is:
1. BufferSequence #
2. SETserver object

Parameters:
set - The SETserver being checkpointed
Returns:
whether the checkpoint was successful
Throws: CheckpointException
if the log file sync fails
 o restore
 public SETserver restore() throws RecoveryException
SETserver restore() ** The method that is called at startup to restore the previous checkpoint contents. The checkpoint files will be read in from the storeDir set in the constructor. The method should be able to return a real SETserver object.

Returns:
the SETserver reconstructed from the checkpoint files and null for failure
Throws: RecoveryException
if the checkpoint and log recovery fails
 o makeLogEntry
 public static String makeLogEntry(int logType,
                                   long sequenceID,
                                   int beginend)
String makeLogEntry(int logType, long sequenceID) ** Method to produce a String formatted log entry based on arguments passed in.
Current arguments include logtype and sequenceID of the document. The log entry has multiple values separated by the "_" character, with multiple entries separated by the newline character.
The order of the arguments is:
(1) logType
(2) sequenceID
(3) beginend
(4) timeStamp (generated in this function)

The specific object/string encoding is decided by the LogEntry class

Parameters:
logType - The static constant value of the log type
sequenceID - The sequence number assigned to this XML document by the SETserver/XSetService.
beginend - An int noting whether the log is for the start or end of an operation.
Returns:
String formatted log entry for writing to buffer

All Packages  Class Hierarchy  This Package  Previous  Next  Index