Class WatermarkedSessionWindowCollection<T>
java.lang.Object
com.scaleoutsoftware.collections.timewindowing.WatermarkedWindowingCollection<T>
com.scaleoutsoftware.collections.timewindowing.WatermarkedSessionWindowCollection<T>
- Type Parameters:
T- the object type of the source collection.
- All Implemented Interfaces:
Iterable<TimeWindow<T>>
The WatermarkedSessionWindowCollection transforms a List into an iterable collection of session windows. This wrapper
class can be used to manage the retention policy of the source collection as well as to insert new objects in
chronological order.
The difference between
SessionWindowCollection and WatermarkedSessionWindowCollection is that
windows in the WatermarkedSessionWindowCollection can be closed if the watermark passes the inclusive end of
a window.-
Field Summary
Fields inherited from class com.scaleoutsoftware.collections.timewindowing.WatermarkedWindowingCollection
sourceCollection, startTimeMs, timestampSelector, watermarkGenerator, watermarkMs -
Constructor Summary
ConstructorsConstructorDescriptionWatermarkedSessionWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long timeoutMs, WatermarkGenerator watermarkGenerator) Instantiates a new SessionWindowCollectionWatermarkedSessionWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long nextWindowStartTimeMs, long timeoutMs, WatermarkGenerator watermarkGenerator, long currentWatermarkMs) Instantiates a new SessionWindowCollection -
Method Summary
Modifier and TypeMethodDescriptionvoidforEach(Consumer<? super TimeWindow<T>> action) longRetrieve the configured session window timeout in milliseconds.iterator()Methods inherited from class com.scaleoutsoftware.collections.timewindowing.WatermarkedWindowingCollection
add, getSourceCollection, getStartTimeMs, getTimestampSelector, getWatermarkGenerator, getWatermarkMs
-
Constructor Details
-
WatermarkedSessionWindowCollection
public WatermarkedSessionWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long startTimeMs, long timeoutMs, WatermarkGenerator watermarkGenerator) Instantiates a new SessionWindowCollection- Parameters:
sourceCollection- the underlying source collection.timestampSelector- theTimestampSelectoris used to pull a timestamp from an item in the source collection and subsequent insertions.startTimeMs- the first time an object can be in a time window -- items before the start time will be evicted. The start time is also the start time of the first time window.timeoutMs- the minimum amount of time between session window ranges.watermarkGenerator- theWatermarkGeneratoris used to generate a watermark. Entries that arrive before the watermark time are evicted. Windows whose inclusive end exceeds the watermark are closed.
-
WatermarkedSessionWindowCollection
public WatermarkedSessionWindowCollection(List<T> sourceCollection, TimestampSelector<T> timestampSelector, long nextWindowStartTimeMs, long timeoutMs, WatermarkGenerator watermarkGenerator, long currentWatermarkMs) Instantiates a new SessionWindowCollection- Parameters:
sourceCollection- the underlying source collection.timestampSelector- theTimestampSelectoris used to pull a timestamp from an item in the source collection and subsequent insertions.nextWindowStartTimeMs- the first time an object can be in a time window -- items before the start time will be evicted. The start time is also the start time of the first time window.timeoutMs- the minimum amount of time between session window ranges.watermarkGenerator- theWatermarkGeneratoris used to generate a watermark. Entries that arrive before the watermark time are evicted. Windows whose inclusive end exceeds the watermark are closed.currentWatermarkMs- the current watermark in milliseconds.
-
-
Method Details
-
getTimeoutMs
public long getTimeoutMs()Retrieve the configured session window timeout in milliseconds.- Returns:
- the timeout in milliseconds.
-
iterator
-
forEach
-
spliterator
-