private WindowManager<I> getWindowManager(WindowConfig windowConfig, Context context) {
WindowLifecycleListener<Event<I>> lifecycleListener = newWindowLifecycleListener(context);
WindowManager<I> manager = new WindowManager<>(lifecycleListener, new ConcurrentLinkedQueue<>());
if (this.windowConfig.getTimestampExtractorClassName() != null) {
this.timestampExtractor = getTimeStampExtractor(windowConfig);
waterMarkEventGenerator = new WaterMarkEventGenerator<>(manager, this.windowConfig
.getWatermarkEmitIntervalMs(),
this.windowConfig.getMaxLagMs(), new HashSet<>(context.getInputTopics()), context);
} else {
if (this.windowConfig.getLateDataTopic() != null) {
throw new IllegalArgumentException(
"Late data topic can be defined only when specifying a timestamp extractor class");
}
}
EvictionPolicy<I, ?> evictionPolicy = getEvictionPolicy(windowConfig);
TriggerPolicy<I, ?> triggerPolicy = getTriggerPolicy(windowConfig, manager,
evictionPolicy, context);
manager.setEvictionPolicy(evictionPolicy);
manager.setTriggerPolicy(triggerPolicy);
return manager;
}