提交 0104a926 编写于 作者: A Aljoscha Krettek

[FLINK-3714] Remove Unneccesary Timer in EventTimeTrigger

In onElement() we registered a timer for the case where the watermark is
already past the end of the window and we're firing anyways. Now, only
add a timer if the watermark is not already past the end of the window.
上级 34a8b03d
......@@ -35,11 +35,13 @@ public class EventTimeTrigger extends Trigger<Object, TimeWindow> {
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
ctx.registerEventTimeTimer(window.maxTimestamp());
return (window.maxTimestamp() <= ctx.getCurrentWatermark()) ?
TriggerResult.FIRE_AND_PURGE :
TriggerResult.CONTINUE;
if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
// if the watermark is already past the window fire immediately
return TriggerResult.FIRE_AND_PURGE;
} else {
ctx.registerEventTimeTimer(window.maxTimestamp());
return TriggerResult.CONTINUE;
}
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册