Class AbstractTridentWindowManager<T>
- java.lang.Object
-
- org.apache.storm.trident.windowing.AbstractTridentWindowManager<T>
-
- All Implemented Interfaces:
ITridentWindowManager
- Direct Known Subclasses:
InMemoryTridentWindowManager
,StoreBasedTridentWindowManager
public abstract class AbstractTridentWindowManager<T> extends Object implements ITridentWindowManager
Basic functionality to manage trident tuple events usingWindowManager
andWindowsStore
for storing tuples and triggers related information.
-
-
Field Summary
Fields Modifier and Type Field Description protected Aggregator
aggregator
protected BatchOutputCollector
delegateCollector
protected Queue<org.apache.storm.trident.windowing.AbstractTridentWindowManager.TriggerResult>
pendingTriggers
protected AtomicInteger
triggerId
protected WindowManager<T>
windowManager
protected WindowsStore
windowStore
protected String
windowTaskId
-
Constructor Summary
Constructors Constructor Description AbstractTridentWindowManager(WindowConfig windowConfig, String windowTaskId, WindowsStore windowStore, Aggregator aggregator, BatchOutputCollector delegateCollector)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Queue<org.apache.storm.trident.windowing.AbstractTridentWindowManager.TriggerResult>
getPendingTriggers()
Returns pending triggers to be emitted.protected abstract List<TridentTuple>
getTridentTuples(List<T> tupleEvents)
ReturnTridentTuple
s from giventupleEvents
.protected abstract void
initialize()
Load and initialize any resources into window manager before windowing for component/task is activated.protected abstract void
onTuplesExpired(List<T> expiredEvents)
Handle expired tuple events which can be removing from cache or store.void
prepare()
This is invoked fromorg.apache.storm.trident.planner.TridentProcessor
's prepare method.void
shutdown()
This is invoked when fromorg.apache.storm.trident.planner.TridentProcessor
's cleanup method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.storm.trident.windowing.ITridentWindowManager
addTuplesBatch
-
-
-
-
Field Detail
-
windowManager
protected final WindowManager<T> windowManager
-
aggregator
protected final Aggregator aggregator
-
delegateCollector
protected final BatchOutputCollector delegateCollector
-
windowTaskId
protected final String windowTaskId
-
windowStore
protected final WindowsStore windowStore
-
pendingTriggers
protected final Queue<org.apache.storm.trident.windowing.AbstractTridentWindowManager.TriggerResult> pendingTriggers
-
triggerId
protected final AtomicInteger triggerId
-
-
Constructor Detail
-
AbstractTridentWindowManager
public AbstractTridentWindowManager(WindowConfig windowConfig, String windowTaskId, WindowsStore windowStore, Aggregator aggregator, BatchOutputCollector delegateCollector)
-
-
Method Detail
-
prepare
public void prepare()
Description copied from interface:ITridentWindowManager
This is invoked fromorg.apache.storm.trident.planner.TridentProcessor
's prepare method. So any initialization tasks can be done before the topology starts accepting tuples. For ex: initialize window manager with any earlier stored tuples/triggers and start WindowManager.- Specified by:
prepare
in interfaceITridentWindowManager
-
initialize
protected abstract void initialize()
Load and initialize any resources into window manager before windowing for component/task is activated.
-
onTuplesExpired
protected abstract void onTuplesExpired(List<T> expiredEvents)
Handle expired tuple events which can be removing from cache or store.
-
getTridentTuples
protected abstract List<TridentTuple> getTridentTuples(List<T> tupleEvents)
ReturnTridentTuple
s from giventupleEvents
.
-
getPendingTriggers
public Queue<org.apache.storm.trident.windowing.AbstractTridentWindowManager.TriggerResult> getPendingTriggers()
Description copied from interface:ITridentWindowManager
Returns pending triggers to be emitted.- Specified by:
getPendingTriggers
in interfaceITridentWindowManager
-
shutdown
public void shutdown()
Description copied from interface:ITridentWindowManager
This is invoked when fromorg.apache.storm.trident.planner.TridentProcessor
's cleanup method. So, any cleanup operations like clearing cache or close store connection etc can be done.- Specified by:
shutdown
in interfaceITridentWindowManager
-
-