Interface Checkpointer
- All Superinterfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final longBlock number indicating no stored value. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransactionId(String transactionId) Add a transaction ID for the current block.voidclose()longGet the current block number, orUNSET_BLOCK_NUMBERif there is no previously saved state.Get the transaction IDs processed within the current block.voidsetBlockNumber(long blockNumber) Set the current block number.
-
Field Details
-
UNSET_BLOCK_NUMBER
static final long UNSET_BLOCK_NUMBERBlock 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
Get the current block number, orUNSET_BLOCK_NUMBERif there is no previously saved state.- Returns:
- A block number.
- Throws:
IOException- if the checkpointer fails to access persistent state.
-
setBlockNumber
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
Get the transaction IDs processed within the current block.- Returns:
- Transaction IDs.
- Throws:
IOException- if the checkpointer fails to access persistent state.
-
addTransactionId
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
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-