Interface Checkpointer

All Superinterfaces:
AutoCloseable

public interface Checkpointer extends AutoCloseable
Persists the current block and transactions within that block to enable event listening to be resumed following an application outage.

Default implementations can be obtained from DefaultCheckpointers. Application developers are encouraged to build their own implementations that use a persistent store suitable to their environment.

Implementations must be thread-safe.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Block number indicating no stored value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTransactionId(String transactionId)
    Add a transaction ID for the current block.
    void
     
    long
    Get the current block number, or UNSET_BLOCK_NUMBER if there is no previously saved state.
    Get the transaction IDs processed within the current block.
    void
    setBlockNumber(long blockNumber)
    Set the current block number.
  • Field Details

    • UNSET_BLOCK_NUMBER

      static final long UNSET_BLOCK_NUMBER
      Block number indicating no stored value. This is the the default for a newly created checkpointer with no previously saved state.
      See Also:
  • Method Details

    • getBlockNumber

      long getBlockNumber() throws IOException
      Get the current block number, or UNSET_BLOCK_NUMBER if there is no previously saved state.
      Returns:
      A block number.
      Throws:
      IOException - if the checkpointer fails to access persistent state.
    • setBlockNumber

      void setBlockNumber(long blockNumber) throws IOException
      Set the current block number. Also clears the stored transaction IDs. Typically set when the previous block has been processed.
      Parameters:
      blockNumber - A block number.
      Throws:
      IOException - if the checkpointer fails to access persistent state.
    • getTransactionIds

      Set<String> getTransactionIds() throws IOException
      Get the transaction IDs processed within the current block.
      Returns:
      Transaction IDs.
      Throws:
      IOException - if the checkpointer fails to access persistent state.
    • addTransactionId

      void addTransactionId(String transactionId) throws IOException
      Add a transaction ID for the current block. Typically called once a transaction has been processed.
      Parameters:
      transactionId - A transaction ID.
      Throws:
      IOException - if the checkpointer fails to access persistent state.
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException