flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] rkhachatryan commented on a change in pull request #10151: [FLINK-14231] Handle the processing-time timers before closing operator to properly support endInput
Date Fri, 15 Nov 2019 11:25:41 GMT
rkhachatryan 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_r346741384
 
 

 ##########
 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?
   And we may call removePendingTimers() twice, but it's fine, since removePendingTimers uses
map internally...
   
   IMO it's not obvious and should be commented.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message