StefanRRichter commented on a change in pull request #7568: [FLINK-11417] Make 
access to ExecutionGraph single threaded from JobMaster main thread
URL: https://github.com/apache/flink/pull/7568#discussion_r250979633
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java
 ##########
 @@ -863,7 +884,20 @@ else if (consumerState == SCHEDULED || consumerState == 
DEPLOYING) {
         * @param t The exception that caused the task to fail.
         */
        @Override
-       public void fail(Throwable t) {
+       public void failAsync(Throwable t) {
+               ComponentMainThreadExecutor mainThreadExecutor = 
vertex.getExecutionGraph().getJobMasterMainThreadExecutor();
+               mainThreadExecutor.execute(() -> failSync(t));
+       }
+
+       /**
+        * This method fails the vertex due to an external condition. The task 
will move to state FAILED.
+        * If the task was in state RUNNING or DEPLOYING before, it will send a 
cancel call to the TaskManager.
+        * This method must be called from the current main thread, otherwise 
use {@link #failAsync(Throwable)}.
+        *
+        * @param t The exception that caused the task to fail.
+        */
+       @Override
+       public void failSync(Throwable t) {
 
 Review comment:
   I had it there before, but removed it because it is checked immediately in 
`processFail`, the only method that is called in `failSync`. It would be like 
checking twice and the check in `processFail` also captures that we came from 
`failSync` in the stack trace. So I think we dont need to introduce a redundant 
check here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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