T - the type of event tracked by this policy.public class CountTriggerPolicy<T> extends java.lang.Object implements TriggerPolicy<T,java.lang.Integer>
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 |
|---|---|
java.lang.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(java.lang.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.
|
java.lang.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)
TriggerPolicytrack in interface TriggerPolicy<T,java.lang.Integer>event - the input eventpublic void reset()
TriggerPolicyreset in interface TriggerPolicy<T,java.lang.Integer>public void start()
TriggerPolicystart in interface TriggerPolicy<T,java.lang.Integer>public void shutdown()
TriggerPolicyshutdown in interface TriggerPolicy<T,java.lang.Integer>public java.lang.Integer getState()
TriggerPolicygetState in interface TriggerPolicy<T,java.lang.Integer>public void restoreState(java.lang.Integer state)
TriggerPolicyrestoreState in interface TriggerPolicy<T,java.lang.Integer>state - the statepublic java.lang.String toString()
toString in class java.lang.Object