public class CountTriggerPolicy<T> extends Object implements TriggerPolicy<T,Integer>
A trigger that tracks event counts and calls back TriggerHandler.onTrigger() when the count threshold is hit.
| Constructor and Description |
|---|
CountTriggerPolicy(int count,
TriggerHandler handler,
EvictionPolicy<T,?> evictionPolicy) |
| Modifier and Type | Method and Description |
|---|---|
Integer |
getState()
Return runtime state to be checkpointed by the framework for restoring the trigger policy in case of failures.
|
void |
reset()
resets the trigger policy.
|
void |
restoreState(Integer state)
Restore the trigger policy from the state that was earlier checkpointed by the framework.
|
void |
shutdown()
Any clean up could be handled here.
|
void |
start()
Starts the trigger policy.
|
String |
toString() |
void |
track(Event<T> event)
Tracks the event and could use this to invoke the trigger.
|
public CountTriggerPolicy(int count,
TriggerHandler handler,
EvictionPolicy<T,?> evictionPolicy)
public void track(Event<T> event)
TriggerPolicyTracks the event and could use this to invoke the trigger.
track in interface TriggerPolicy<T,Integer>event - the input eventpublic void reset()
TriggerPolicyresets the trigger policy.
reset in interface TriggerPolicy<T,Integer>public void start()
TriggerPolicyStarts the trigger policy. This can be used during recovery to start the triggers after recovery is complete.
start in interface TriggerPolicy<T,Integer>public void shutdown()
TriggerPolicyAny clean up could be handled here.
shutdown in interface TriggerPolicy<T,Integer>public Integer getState()
TriggerPolicyReturn runtime state to be checkpointed by the framework for restoring the trigger policy in case of failures.
getState in interface TriggerPolicy<T,Integer>public void restoreState(Integer state)
TriggerPolicyRestore the trigger policy from the state that was earlier checkpointed by the framework.
restoreState in interface TriggerPolicy<T,Integer>state - the stateCopyright © 2021 The Apache Software Foundation. All rights reserved.