Class Checkpoint

java.lang.Object
org.apache.uima.collection.impl.cpm.Checkpoint
All Implemented Interfaces:
Runnable

public class Checkpoint extends Object implements Runnable
Runing in a seperate thread creates a checkpoint file at predefined intervals.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private long
    The checkpoint frequency.
    private BaseCPMImpl
    The cpm.
    private String
    The file name.
    private final Object
    The lock for pause.
    private boolean
    The pause.
    private boolean
    The stop.
    private String
    The synch point file name.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Checkpoint(BaseCPMImpl aCpm, 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

    Modifier and Type
    Method
    Description
    void
    Deletes checkpoint file from the filesystem.
    void
    Serializes checkpoint information to disk.
    boolean
    Returns true if configured checkpoinjt file exists on disk.
    void
    Pauses checkpoint thread.
    static void
    printEveList(List lst, int tCnt)
    Prints the list of Process Events in the order that they were produced.
    static void
    Prints the stats.
    void
    rename(String aFilename)
    Renames previous checkpoint file.
    Retrieves the checkpoint from the filesystem.
    void
    Resumes checkpoint thread.
    void
    run()
    Starts the checkpoint thread and runs until the cpe tells it to stop.
    void
    Stops the checkpoint thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fileName

      private 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 Object lockForPause
      The lock for pause.
    • cpm

      private BaseCPMImpl cpm
      The cpm.
    • synchPointFileName

      private String synchPointFileName
      The synch point file name.
  • Constructor Details

    • Checkpoint

      public Checkpoint(BaseCPMImpl aCpm, 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 cpm
      aFilename - the a filename
      aCheckpointFrequency - the a checkpoint frequency
  • Method Details

    • 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:
      run in interface 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(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(List lst, int tCnt)
      Prints the list of Process Events in the order that they were produced.
      Parameters:
      lst - List of ProcessEvent
      tCnt - 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 Object restoreFromCheckpoint() throws IOException
      Retrieves the checkpoint from the filesystem.
      Returns:
      - desirialized object containing recovery information.
      Throws:
      IOException - -