TisonKun commented on a change in pull request #10408: [FLINK-14992][client] 
Add job listener to execution environments
URL: https://github.com/apache/flink/pull/10408#discussion_r353521858
 
 

 ##########
 File path: 
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
 ##########
 @@ -886,13 +886,15 @@ public void clearJobListener() {
                        "Cannot find compatible factory for specified 
execution.target (=%s)",
                        configuration.get(DeploymentOptions.TARGET));
 
-               return executorFactory
+               CompletableFuture<JobClient> jobClient = executorFactory
                        .getExecutor(configuration)
-                       .execute(plan, configuration)
-                       .thenApply(jobClient -> {
-                               jobListeners.forEach(jobListener -> 
jobListener.onJobSubmitted(jobClient));
-                               return jobClient;
-                       });
+                       .execute(plan, configuration);
+
+               jobClient.thenAcceptAsync(innerJobClient -> {
 
 Review comment:
   We should call the `Async` version if we want to asynchronously run 
`onJobSubmitted`. It's not only we return in the same thread in 
`JobClusterExecutor` implementation but `CompletableFuture.thenAccept` is 
always possibly called in current thread if the future is completed when 
`thenXXX` called.

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