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.StringIBM_COPYRIGHT
-
Constructor Summary
Constructors Constructor and Description DelegateStateHandler(T handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcheckpoint(Checkpoint checkpoint)Checkpoint the operator state to support resetting of its state to the saved state, usingStateHandler.reset(Checkpoint).voidclose()voiddrain()Drain any outstanding processing.TgetDelegateHandler()voidprepareForNonBlockingCheckpoint(long id)Called to prepare for non-blocking checkpoint.voidregionCheckpointed(long id)Called when the whole consistent region has been drained and checkpointed.voidreset(Checkpoint checkpoint)Reset the operator to a previous state defined bycheckpoint.voidresetToInitialState()Reset the operator to its initial state.voidretireCheckpoint(long id)Called when a checkpoint can be retired.
-
-
-
Field Detail
-
IBM_COPYRIGHT
public static final java.lang.String IBM_COPYRIGHT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DelegateStateHandler
public DelegateStateHandler(T handler)
-
-
Method Detail
-
getDelegateHandler
public T getDelegateHandler()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.io.IOException
-
drain
public void drain() throws java.lang.ExceptionDescription copied from interface:StateHandlerDrain 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
processandprocessPunctuationhave returned for all tuples and marks. - A
permitis 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:
drainin interfaceStateHandler- Throws:
java.lang.Exception- Exception attempting to drain state.
-
reset
public void reset(Checkpoint checkpoint) throws java.lang.Exception
Description copied from interface:StateHandlerReset the operator to a previous state defined bycheckpoint.When in a consistent region
checkpointcorresponds to the a previous successful drain and checkpoint cut cycle for the entire region. state.- Specified by:
resetin interfaceStateHandler- Throws:
java.lang.Exception- Exception attempting to reset state.
-
checkpoint
public void checkpoint(Checkpoint checkpoint) throws java.lang.Exception
Description copied from interface:StateHandlerCheckpoint the operator state to support resetting of its state to the saved state, usingStateHandler.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:
checkpointin interfaceStateHandler- Throws:
java.lang.Exception- Exception attempting to checkpoint state.
-
-
retireCheckpoint
public void retireCheckpoint(long id) throws java.lang.ExceptionDescription copied from interface:StateHandlerCalled when a checkpoint can be retired.- Specified by:
retireCheckpointin interfaceStateHandler- Parameters:
id- Id of checkpoint.- Throws:
java.lang.Exception- Exception attempting to retire a checkpoint state.
-
resetToInitialState
public void resetToInitialState() throws java.lang.ExceptionDescription copied from interface:StateHandlerReset 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:
resetToInitialStatein interfaceStateHandler- Throws:
java.lang.Exception- Exception attempting to retire a checkpoint state.
-
prepareForNonBlockingCheckpoint
public void prepareForNonBlockingCheckpoint(long id) throws java.lang.ExceptionDescription copied from interface:StateHandlerCalled 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 afterStateHandler.drain()and beforeStateHandler.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:
prepareForNonBlockingCheckpointin interfaceStateHandler- 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.ExceptionDescription copied from interface:StateHandlerCalled 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:
regionCheckpointedin interfaceStateHandler- Parameters:
id- Id of checkpoint.- Throws:
java.lang.Exception- Exception attempting to notify start operator that the region has been drained and checkpointed.
-
-