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
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String IBM_COPYRIGHT 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void checkpoint(Checkpoint checkpoint)
      Checkpoint the operator state to support resetting of its state to the saved state, using StateHandler.reset(Checkpoint).
      void close() 
      void drain()
      Drain any outstanding processing.
      T getDelegateHandler() 
      void reset(Checkpoint checkpoint)
      Reset the operator to a previous state defined by checkpoint.
      void resetToInitialState()
      Reset the operator to its initial state.
      void retireCheckpoint(long id)
      Called when a checkpoint can be retired.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.