com.ibm.streams.operator.state
Interface CheckpointContext
-
- All Superinterfaces:
- OptionalContext
public interface CheckpointContext extends OptionalContext
Context information that allows operators to create or restore checkpoint data of their state information.Operator data can be checkpointed or restored in 2 ways:
- Periodic: An application specifies a
checkpoint: periodic
config option for an operator with a corresponding time interval in SPL. - Operator-driven: Operator can request a synchronous, operator-driven checkpoint. The
checkpoint: operatorDriven
option is specified in SPL.
StateHandler
must be registered with theOperatorContext.registerStateHandler()
method. In the case of periodic checkpointing, theStateHandler.checkpoint()
method will be automatically called by the SPL Runtime at configured interval.
In case of operatorDriven checkpointing, the operator can request a checkpoint by calling the createCheckpoint() method within this interface.
When an operator is restarted, theStateHandler.reset()
is automatically called by the SPL Runtime to restore operator's state from checkpoint.
Note that a checkpoint context is only available if checkpointing is enabled for an operator otherwise theOperatorContext.getOptionalContext(CheckpointContext.class)
call will return null.- Since:
- InfoSphere® Streams Version 4.0
- See Also:
OperatorContext.getOptionalContext(Class)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static class
CheckpointContext.Kind
TODO
-
Method Summary
Methods Modifier and Type Method and Description boolean
createCheckpoint()
Create a checkpoint.double
getCheckpointingInterval()
Returns the checkpointing interval if periodic checkpointing is configured.CheckpointContext.Kind
getKind()
Return the kind of the configured checkpointing.boolean
isEnabled()
Return whether checkpointing/restore is enabled.
-
-
-
Method Detail
-
getKind
CheckpointContext.Kind getKind()
Return the kind of the configured checkpointing.- Returns:
- kind of the configured checkpointing.
-
getCheckpointingInterval
double getCheckpointingInterval()
Returns the checkpointing interval if periodic checkpointing is configured. This method returns <0 if operatorDriven checkpointing is configured.- Returns:
- the checkpointing interval for periodic checkpointing or <0 otherwise
-
createCheckpoint
boolean createCheckpoint() throws java.io.IOException
Create a checkpoint. This will trigger a call to the registeredStateHandler.checkpoint()
method.- Returns:
- True if checkpointing is successful, false if checkpointing is not enabled.
- Throws:
java.io.IOException
- if there is any error during creating a checkpoint.
-
isEnabled
boolean isEnabled()
Return whether checkpointing/restore is enabled.- Returns:
- True if checkpointing/restore is enabled, false otherwise.
-
-