StefanRRichter commented on a change in pull request #8692: [FLINK-12804] 
Introduce mailbox-based ExecutorService
URL: https://github.com/apache/flink/pull/8692#discussion_r292525933
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
 ##########
 @@ -252,23 +262,35 @@ protected StreamTask(
         * Runs the stream-tasks main processing loop.
         */
        private void run() throws Exception {
-               final ActionContext actionContext = new ActionContext();
+               final Mailbox mailbox = taskMailboxExecutor.getMailbox();
+               final ActionContext actionContext = new ActionContext(mailbox);
+
+               mailbox.open();
+               mailboxLoopRunning = true;
+
                while (true) {
+
                        if (mailbox.hasMail()) {
                                Optional<Runnable> maybeLetter;
                                while ((maybeLetter = 
mailbox.tryTakeMail()).isPresent()) {
-                                       Runnable letter = maybeLetter.get();
-                                       if (letter == POISON_LETTER) {
+                                       if (!mailboxLoopRunning) {
 
 Review comment:
   I think that can be fixed by moving the before taking letters. The purpose 
of this bit more complex logic is that we assume change of `mailboxLoopRunning` 
is always connected to a letter and with this we do not have to check this 
field on each loop iteration, but only when we process mail. Therefore no check 
is required again for the default action. 

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