Package org.apache.storm.windowing
Class StatefulWindowManager<T>
java.lang.Object
org.apache.storm.windowing.WindowManager<T>
org.apache.storm.windowing.StatefulWindowManager<T>
- All Implemented Interfaces:
TriggerHandler
Window manager that handles windows with state persistence.
-
Field Summary
Fields inherited from class org.apache.storm.windowing.WindowManager
evictionPolicy, EXPIRE_EVENTS_THRESHOLD, queue, triggerPolicy, windowLifecycleListener
-
Constructor Summary
ConstructorDescriptionStatefulWindowManager
(WindowLifecycleListener<T> lifecycleListener) StatefulWindowManager
(WindowLifecycleListener<T> lifecycleListener, Collection<Event<T>> queue) Constructs aStatefulWindowManager
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
expires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.boolean
The callback invoked by the trigger policy.Methods inherited from class org.apache.storm.windowing.WindowManager
add, add, add, getEarliestEventTs, getEventCount, getSlidingCountTimestamps, getState, restoreState, setEvictionPolicy, setTriggerPolicy, shutdown, toString
-
Constructor Details
-
StatefulWindowManager
-
StatefulWindowManager
public StatefulWindowManager(WindowLifecycleListener<T> lifecycleListener, Collection<Event<T>> queue) Constructs aStatefulWindowManager
.- Parameters:
lifecycleListener
- theWindowLifecycleListener
queue
- a collection where the events in the window can be enqueued.
Note: This collection has to be thread safe.
-
-
Method Details
-
compactWindow
protected void compactWindow()Description copied from class:WindowManager
expires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.- Overrides:
compactWindow
in classWindowManager<T>
-
onTrigger
public boolean onTrigger()Description copied from class:WindowManager
The callback invoked by the trigger policy.- Specified by:
onTrigger
in interfaceTriggerHandler
- Overrides:
onTrigger
in classWindowManager<T>
- Returns:
- true if the window was evaluated with at least one event in the window, false otherwise
-