Class Checkpoint
- java.lang.Object
-
- org.apache.uima.collection.impl.cpm.Checkpoint
-
- All Implemented Interfaces:
java.lang.Runnable
public class Checkpoint extends java.lang.Object implements java.lang.RunnableRuning in a seperate thread creates a checkpoint file at predefined intervals.
-
-
Field Summary
Fields Modifier and Type Field Description private longcheckpointFrequencyThe checkpoint frequency.private BaseCPMImplcpmThe cpm.private java.lang.StringfileNameThe file name.private java.lang.ObjectlockForPauseThe lock for pause.private booleanpauseThe pause.private booleanstopThe stop.private java.lang.StringsynchPointFileNameThe synch point file name.
-
Constructor Summary
Constructors Constructor Description Checkpoint(BaseCPMImpl aCpm, java.lang.String aFilename, long aCheckpointFrequency)Initialize the checkpoint with a reference to controlling cpe, the file where the checkpoint is to be stored, and the frequency of checkpoints.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Deletes checkpoint file from the filesystem.voiddoCheckpoint()Serializes checkpoint information to disk.booleanexists()Returns true if configured checkpoinjt file exists on disk.voidpause()Pauses checkpoint thread.static voidprintEveList(java.util.List lst, int tCnt)Prints the list of Process Events in the order that they were produced.static voidprintStats(ProcessTrace prT)Prints the stats.voidrename(java.lang.String aFilename)Renames previous checkpoint file.java.lang.ObjectrestoreFromCheckpoint()Retrieves the checkpoint from the filesystem.voidresume()Resumes checkpoint thread.voidrun()Starts the checkpoint thread and runs until the cpe tells it to stop.voidstop()Stops the checkpoint thread.
-
-
-
Field Detail
-
fileName
private java.lang.String fileName
The file name.
-
stop
private volatile boolean stop
The stop.
-
checkpointFrequency
private long checkpointFrequency
The checkpoint frequency.
-
pause
private boolean pause
The pause.
-
lockForPause
private final java.lang.Object lockForPause
The lock for pause.
-
cpm
private BaseCPMImpl cpm
The cpm.
-
synchPointFileName
private java.lang.String synchPointFileName
The synch point file name.
-
-
Constructor Detail
-
Checkpoint
public Checkpoint(BaseCPMImpl aCpm, java.lang.String aFilename, long aCheckpointFrequency)
Initialize the checkpoint with a reference to controlling cpe, the file where the checkpoint is to be stored, and the frequency of checkpoints.- Parameters:
aCpm- the a cpmaFilename- the a filenameaCheckpointFrequency- the a checkpoint frequency
-
-
Method Detail
-
stop
public void stop()
Stops the checkpoint thread.
-
run
public void run()
Starts the checkpoint thread and runs until the cpe tells it to stop.- Specified by:
runin interfacejava.lang.Runnable
-
delete
public void delete()
Deletes checkpoint file from the filesystem.
-
pause
public void pause()
Pauses checkpoint thread.
-
resume
public void resume()
Resumes checkpoint thread.
-
doCheckpoint
public void doCheckpoint()
Serializes checkpoint information to disk. It retrieves data to checkpoint from the CPEEngine.
-
rename
public void rename(java.lang.String aFilename)
Renames previous checkpoint file.- Parameters:
aFilename- - checkpoint file to rename
-
printStats
public static void printStats(ProcessTrace prT)
Prints the stats.- Parameters:
prT- the pr T
-
printEveList
public static void printEveList(java.util.List lst, int tCnt)Prints the list of Process Events in the order that they were produced.- Parameters:
lst- List of ProcessEventtCnt- depth of this List in the Process Trace hierarchy
-
exists
public boolean exists()
Returns true if configured checkpoinjt file exists on disk.- Returns:
- - true if file exists, false otherwise
-
restoreFromCheckpoint
public java.lang.Object restoreFromCheckpoint() throws java.io.IOExceptionRetrieves the checkpoint from the filesystem.- Returns:
- - desirialized object containing recovery information.
- Throws:
java.io.IOException- -
-
-