Package org.apache.storm.windowing
Class CountTriggerPolicy<T>
- java.lang.Object
-
- org.apache.storm.windowing.CountTriggerPolicy<T>
-
- Type Parameters:
T- the type of event tracked by this policy.
- All Implemented Interfaces:
TriggerPolicy<T,Integer>
public class CountTriggerPolicy<T> extends Object implements TriggerPolicy<T,Integer>
A trigger that tracks event counts and calls backTriggerHandler.onTrigger()when the count threshold is hit.
-
-
Constructor Summary
Constructors Constructor Description CountTriggerPolicy(int count, TriggerHandler handler, EvictionPolicy<T,?> evictionPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegergetState()Return runtime state to be checkpointed by the framework for restoring the trigger policy in case of failures.voidreset()resets the trigger policy.voidrestoreState(Integer state)Restore the trigger policy from the state that was earlier checkpointed by the framework.voidshutdown()Any clean up could be handled here.voidstart()Starts the trigger policy.StringtoString()voidtrack(Event<T> event)Tracks the event and could use this to invoke the trigger.
-
-
-
Constructor Detail
-
CountTriggerPolicy
public CountTriggerPolicy(int count, TriggerHandler handler, EvictionPolicy<T,?> evictionPolicy)
-
-
Method Detail
-
track
public void track(Event<T> event)
Description copied from interface:TriggerPolicyTracks the event and could use this to invoke the trigger.- Specified by:
trackin interfaceTriggerPolicy<T,Integer>- Parameters:
event- the input event
-
reset
public void reset()
Description copied from interface:TriggerPolicyresets the trigger policy.- Specified by:
resetin interfaceTriggerPolicy<T,Integer>
-
start
public void start()
Description copied from interface:TriggerPolicyStarts the trigger policy. This can be used during recovery to start the triggers after recovery is complete.- Specified by:
startin interfaceTriggerPolicy<T,Integer>
-
shutdown
public void shutdown()
Description copied from interface:TriggerPolicyAny clean up could be handled here.- Specified by:
shutdownin interfaceTriggerPolicy<T,Integer>
-
getState
public Integer getState()
Description copied from interface:TriggerPolicyReturn runtime state to be checkpointed by the framework for restoring the trigger policy in case of failures.- Specified by:
getStatein interfaceTriggerPolicy<T,Integer>- Returns:
- the state
-
restoreState
public void restoreState(Integer state)
Description copied from interface:TriggerPolicyRestore the trigger policy from the state that was earlier checkpointed by the framework.- Specified by:
restoreStatein interfaceTriggerPolicy<T,Integer>- Parameters:
state- the state
-
-