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:

    1. Periodic: An application specifies a checkpoint: periodic config option for an operator with a corresponding time interval in SPL.
    2. Operator-driven: Operator can request a synchronous, operator-driven checkpoint. The checkpoint: operatorDriven option is specified in SPL.
    In each of the above scenarios, a valid StateHandler must be registered with the OperatorContext.registerStateHandler() method. In the case of periodic checkpointing, the StateHandler.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, the StateHandler.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 the OperatorContext.getOptionalContext(CheckpointContext.class) call will return null.

    Since:
    InfoSphere® Streams Version 4.0
    See Also:
    OperatorContext.getOptionalContext(Class)
    • 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 registered StateHandler.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.