sunhaibotb commented on a change in pull request #10151: [FLINK-14231] Handle
the processing-time timers before closing operator to properly support endInput
URL: https://github.com/apache/flink/pull/10151#discussion_r347300823
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ProcessingTimeServiceImpl.java
##########
@@ -39,11 +63,110 @@ public long getCurrentProcessingTime() {
@Override
public ScheduledFuture<?> registerTimer(long timestamp,
ProcessingTimeCallback target) {
- return timerService.registerTimer(timestamp,
processingTimeCallbackWrapper.apply(target));
+ if (isQuiesced) {
+ return new NeverCompleteFuture(
+
ProcessingTimeServiceUtil.getProcessingTimeDelay(timestamp,
getCurrentProcessingTime()));
+ }
+
+ final TimerScheduledFuture<?> timer = new
TimerScheduledFuture<>();
+ timer.setTimer(timerService.registerTimer(timestamp,
invokeCallbackAndRemovePending(timer, target)));
+
+ pendingTimers.put(timer, true);
+ if (timer.isDone()) {
Review comment:
> We are preventing a race condition here, if timer fires before we put it,
right?
Yes.
> IMO it's not obvious and should be commented.
+1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services