rkhachatryan commented on a change in pull request #10345: 
[FLINK-12484][runtime] synchronize all mailbox actions
URL: https://github.com/apache/flink/pull/10345#discussion_r352573382
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/Mail.java
 ##########
 @@ -52,8 +54,10 @@ public int getPriority() {
                return priority;
        }
 
-       public Runnable getRunnable() {
-               return runnable;
+       public void tryCancel(boolean mayInterruptIfRunning) {
+               if (runnable instanceof Future) {
+                       ((Future<?>) runnable).cancel(mayInterruptIfRunning);
+               }
 
 Review comment:
   Agree, but since `runnable` is encapsulated in `Mail` then it's the 
responsibility of `Mail` to cancel it if possible.
   One approach that comes to mind is to construct `Mail` with `closeCallback` 
along with `Runnable`, but that seems overcomplicated.

----------------------------------------------------------------
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

Reply via email to