You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/12/04 02:28:12 UTC

[GitHub] [flink] TisonKun commented on a change in pull request #10408: [FLINK-14992][client] Add job listener to execution environments

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 return `onJobSubmitted`. It's not only we returns 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:
users@infra.apache.org


With regards,
Apache Git Services