Package org.apache.storm.windowing
Class TimeEvictionPolicy<T>
java.lang.Object
org.apache.storm.windowing.TimeEvictionPolicy<T>
- All Implemented Interfaces:
- EvictionPolicy<T,- EvictionContext> 
- Direct Known Subclasses:
- WatermarkTimeEvictionPolicy
Eviction policy that evicts events based on time duration.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.storm.windowing.EvictionPolicyEvictionPolicy.Action
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionTimeEvictionPolicy(int windowLength) Constructs a TimeEvictionPolicy that evicts events older than the given window length in millis.
- 
Method SummaryModifier 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(EvictionContext 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- 
evictionContext
 
- 
- 
Constructor Details- 
TimeEvictionPolicypublic TimeEvictionPolicy(int windowLength) Constructs a TimeEvictionPolicy that evicts events older than the given window length in millis.- Parameters:
- windowLength- the duration in milliseconds
 
 
- 
- 
Method Details- 
evictDecides if an event should be expired from the window, processed in the current window or kept for later processing.- Specified by:
- evictin interface- EvictionPolicy<T,- EvictionContext> 
- Parameters:
- event- the input event
- Returns:
- the EvictionPolicy.Actionto be taken based on the input event
 
- 
trackDescription copied from interface:EvictionPolicyTracks the event to later decide whetherEvictionPolicy.evict(Event)should evict it or not.- Specified by:
- trackin interface- EvictionPolicy<T,- EvictionContext> 
- Parameters:
- event- the input event to be tracked
 
- 
getContextDescription copied from interface:EvictionPolicyReturns the current context that is part of this eviction policy.- Specified by:
- getContextin interface- EvictionPolicy<T,- EvictionContext> 
- Returns:
- the eviction context
 
- 
setContextDescription 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 interface- EvictionPolicy<T,- EvictionContext> 
- Parameters:
- context- the eviction context
 
- 
resetpublic void reset()Description copied from interface:EvictionPolicyResets the eviction policy.- Specified by:
- resetin interface- EvictionPolicy<T,- EvictionContext> 
 
- 
getStateDescription copied from interface:EvictionPolicyReturn runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.- Specified by:
- getStatein interface- EvictionPolicy<T,- EvictionContext> 
- Returns:
- the state
 
- 
restoreStateDescription copied from interface:EvictionPolicyRestore the eviction policy from the state that was earlier checkpointed by the framework.- Specified by:
- restoreStatein interface- EvictionPolicy<T,- EvictionContext> 
- Parameters:
- state- the state
 
- 
toString
 
-