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_r354202037
########## 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: With implementation detail, the resource can be re-created by configuration after closed. The concern we handle it asynchronously is because `JobListener`'s callbacks can be expensive. We can do as you said with mentioning DO NOT invoke expensive calls in callbacks ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services