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
ConstructorsConstructorDescriptionStatefulWindowManager(WindowLifecycleListener<T> lifecycleListener) StatefulWindowManager(WindowLifecycleListener<T> lifecycleListener, Collection<Event<T>> queue) Constructs aStatefulWindowManager. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexpires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.booleanThe 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- theWindowLifecycleListenerqueue- 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:WindowManagerexpires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.- Overrides:
compactWindowin classWindowManager<T>
-
onTrigger
public boolean onTrigger()Description copied from class:WindowManagerThe callback invoked by the trigger policy.- Specified by:
onTriggerin interfaceTriggerHandler- Overrides:
onTriggerin classWindowManager<T>- Returns:
- true if the window was evaluated with at least one event in the window, false otherwise
-