com.ibm.streams.operator.state

Class DelegateStateHandler<T extends StateHandler>

  • java.lang.Object
    • com.ibm.streams.operator.state.DelegateStateHandler<T>
  • Type Parameters:
    T -
    All Implemented Interfaces:
    StateHandler, java.io.Closeable, java.lang.AutoCloseable


    public class DelegateStateHandler<T extends StateHandler>
    extends java.lang.Object
    implements StateHandler
    TODO
    Since:
    InfoSphere® Streams Version 4.0
    • Constructor Detail

      • DelegateStateHandler

        public DelegateStateHandler(T handler)
    • Method Detail

      • getDelegateHandler

        public T getDelegateHandler()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.io.IOException
      • drain

        public void drain()
                   throws java.lang.Exception
        Description copied from interface: StateHandler
        Drain any outstanding processing. Once this method returns, the operator is indicating that it has drained all outstanding processing for all input ports.
        The method may:
        • Submit tuples to output ports.
        • Interact with external systems
        • Wait for background activity to drain outstanding work

        For a consistent region:

        • This method is called once all tuples and marks for the current cut for all data (non-control) input ports in the region have been processed, meaning the process and processPunctuation have returned for all tuples and marks.
        • A permit is implicitly acquired before the method is called, and released once it returns.
        • This method is not called concurrently with tuple or mark processing for any data (non-control) input ports in the region.
        • This method is may be called concurrently with tuple or mark or mark processing for any autonomous input ports

        Specified by:
        drain in interface StateHandler
        Throws:
        java.lang.Exception - Exception attempting to drain state.
      • reset

        public void reset(Checkpoint checkpoint)
                   throws java.lang.Exception
        Description copied from interface: StateHandler
        Reset the operator to a previous state defined by checkpoint.

        When in a consistent region checkpoint corresponds to the a previous successful drain and checkpoint cut cycle for the entire region. state.

        Specified by:
        reset in interface StateHandler
        Throws:
        java.lang.Exception - Exception attempting to reset state.
      • checkpoint

        public void checkpoint(Checkpoint checkpoint)
                        throws java.lang.Exception
        Description copied from interface: StateHandler
        Checkpoint the operator state to support resetting of its state to the saved state, using StateHandler.reset(Checkpoint).

        For a consistent region this method is called when:

        • StateHandler.drain() has completed
        • All background threads have released processing permits.
        • All control input ports (if any) have been drained.

        Specified by:
        checkpoint in interface StateHandler
        Throws:
        java.lang.Exception - Exception attempting to checkpoint state.
      • retireCheckpoint

        public void retireCheckpoint(long id)
                              throws java.lang.Exception
        Description copied from interface: StateHandler
        Called when a checkpoint can be retired.
        Specified by:
        retireCheckpoint in interface StateHandler
        Parameters:
        id - Id of checkpoint.
        Throws:
        java.lang.Exception - Exception attempting to retire a checkpoint state.
      • resetToInitialState

        public void resetToInitialState()
                                 throws java.lang.Exception
        Description copied from interface: StateHandler
        Reset the operator to its initial state.

        If the operator is in a consistent region then this is called if a reset occurs prior to the first successful completion of drain and checkpoint cycle for the region.
        This method is not called when the operator first initializes.

        Specified by:
        resetToInitialState in interface StateHandler
        Throws:
        java.lang.Exception - Exception attempting to retire a checkpoint state.
      • prepareForNonBlockingCheckpoint

        public void prepareForNonBlockingCheckpoint(long id)
                                             throws java.lang.Exception
        Description copied from interface: StateHandler
        Called to prepare for non-blocking checkpoint.

        This method is executed only when the operator enables non-blocking checkpointing with the ConsistentRegionContext.enableNonBlockingCheckpoint() method. This method is guaranteed to execute after StateHandler.drain() and before StateHandler.checkpoint(Checkpoint). It is also guaranteed to execute before the consistent region resumes tuple processing.
        This method was added after the interface was released in Version 4.0. It is defined as a default method for compatibility reasons. The default implementation is sufficient if the operator does not support non-blocking checkpoint.

        Specified by:
        prepareForNonBlockingCheckpoint in interface StateHandler
        Parameters:
        id - Id of checkpoint.
        Throws:
        java.lang.Exception - Exception attempting to prepare for non-blocking checkpoint.
      • regionCheckpointed

        public void regionCheckpointed(long id)
                                throws java.lang.Exception
        Description copied from interface: StateHandler
        Called when the whole consistent region has been drained and checkpointed.

        When all operators in a consistent region have finished checkpointing (including non-blocking checkpointing), this method is called to notify start operator(s) of the region. This method is called only for start operator(s) of a consistent region.
        This method was added after the interface was released in Version 4.0. It is defined as a default method for compatibility reasons.

        Specified by:
        regionCheckpointed in interface StateHandler
        Parameters:
        id - Id of checkpoint.
        Throws:
        java.lang.Exception - Exception attempting to notify start operator that the region has been drained and checkpointed.