Package org.apache.storm.windowing
Class CountEvictionPolicy<T>
java.lang.Object
org.apache.storm.windowing.CountEvictionPolicy<T>
- Type Parameters:
T- the type of event tracked by this policy.
- All Implemented Interfaces:
EvictionPolicy<T,Long>
An eviction policy that tracks event counts and can evict based on a threshold count.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.storm.windowing.EvictionPolicy
EvictionPolicy.Action -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecides if an event should be expired from the window, processed in the current window or kept for later processing.Returns the current context that is part of this eviction policy.getState()Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.voidreset()Resets the eviction policy.voidrestoreState(Long state) Restore the eviction policy from the state that was earlier checkpointed by the framework.voidsetContext(EvictionContext context) Sets a context in the eviction policy that can be used while evicting the events.toString()voidTracks the event to later decide whetherEvictionPolicy.evict(Event)should evict it or not.
-
Field Details
-
threshold
protected final int threshold -
currentCount
-
-
Constructor Details
-
CountEvictionPolicy
public CountEvictionPolicy(int count)
-
-
Method Details
-
evict
Description copied from interface:EvictionPolicyDecides if an event should be expired from the window, processed in the current window or kept for later processing.- Specified by:
evictin interfaceEvictionPolicy<T,Long> - Parameters:
event- the input event- Returns:
- the
EvictionPolicy.Actionto be taken based on the input event
-
track
Description copied from interface:EvictionPolicyTracks the event to later decide whetherEvictionPolicy.evict(Event)should evict it or not.- Specified by:
trackin interfaceEvictionPolicy<T,Long> - Parameters:
event- the input event to be tracked
-
getContext
Description copied from interface:EvictionPolicyReturns the current context that is part of this eviction policy.- Specified by:
getContextin interfaceEvictionPolicy<T,Long> - Returns:
- the eviction context
-
setContext
Description copied from interface:EvictionPolicySets a context in the eviction policy that can be used while evicting the events. E.g. For TimeEvictionPolicy, this could be used to set the reference timestamp.- Specified by:
setContextin interfaceEvictionPolicy<T,Long> - Parameters:
context- the eviction context
-
toString
-
reset
public void reset()Description copied from interface:EvictionPolicyResets the eviction policy.- Specified by:
resetin interfaceEvictionPolicy<T,Long>
-
getState
Description copied from interface:EvictionPolicyReturn runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.- Specified by:
getStatein interfaceEvictionPolicy<T,Long> - Returns:
- the state
-
restoreState
Description copied from interface:EvictionPolicyRestore the eviction policy from the state that was earlier checkpointed by the framework.- Specified by:
restoreStatein interfaceEvictionPolicy<T,Long> - Parameters:
state- the state
-