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

 ##########
 File path: 
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
 ##########
 @@ -865,9 +900,20 @@ public JobExecutionResult execute(String jobName) throws 
Exception {
                        "Cannot find compatible factory for specified 
execution.target (=%s)",
                        configuration.get(DeploymentOptions.TARGET));
 
-               return executorFactory
+               CompletableFuture<JobClient> jobClientFuture = executorFactory
                        .getExecutor(configuration)
                        .execute(plan, configuration);
+
+               jobClientFuture.whenCompleteAsync((jobClient, throwable) -> {
 
 Review comment:
   Ah, both `JobClient` and `ClusterClient` can be duplicated after they have 
been closed. Maybe we should add a test to guard that behaviour then. 

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