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: periodicconfig option for an operator with a corresponding time interval in SPL. - Operator-driven: Operator can request a synchronous, operator-driven checkpoint. The
checkpoint: operatorDrivenoption is specified in SPL.
StateHandlermust 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 classCheckpointContext.KindTODO
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleancreateCheckpoint()Create a checkpoint.doublegetCheckpointingInterval()Returns the checkpointing interval if periodic checkpointing is configured.CheckpointContext.KindgetKind()Return the kind of the configured checkpointing.booleanisEnabled()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.IOExceptionCreate 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.
-
-