Package org.apache.heron.api.topology
Interface IStatefulComponent<K extends Serializable,V extends Serializable>
-
- All Superinterfaces:
IComponent,Serializable
- All Known Subinterfaces:
IStatefulWindowedBolt<K,V>,ITwoPhaseStatefulComponent<K,V>
- All Known Implementing Classes:
BaseStatefulWindowedBolt,ComplexSink,ComplexSource,StatefulWindowedBoltExecutor,StreamletSource,SupplierSource,TransformOperator,WindowedBoltExecutor
public interface IStatefulComponent<K extends Serializable,V extends Serializable> extends IComponent
Defines a component that saves its internal state in the State interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidinitState(State<K,V> state)Initializes the state of the function or operator to that of a previous checkpoint.voidpreSave(String checkpointId)This is a hook for the component to perform some actions just before the framework saves its state.-
Methods inherited from interface org.apache.heron.api.topology.IComponent
declareOutputFields, getComponentConfiguration
-
-
-
-
Method Detail
-
initState
void initState(State<K,V> state)
Initializes the state of the function or operator to that of a previous checkpoint. This method is invoked when a component is executed as part of a recovery run. In case there was prior state associated with the component, the state will be empty. Stateful Spouts/Bolts are expected to hold on to the state variable to save their internal stateNote that initialState() is called before open() or prepare().
- Parameters:
state- the previously saved state of the component.
-
preSave
void preSave(String checkpointId)
This is a hook for the component to perform some actions just before the framework saves its state.- Parameters:
checkpointId- the ID of the checkpoint
-
-