kl0u commented on a change in pull request #10392: [FLINK-14854][client] Add 
executeAsync() method to execution environments
URL: https://github.com/apache/flink/pull/10392#discussion_r353118113
 
 

 ##########
 File path: 
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
 ##########
 @@ -812,18 +854,16 @@ public JobExecutionResult execute(String jobName) throws 
Exception {
 
                final Plan plan = createProgramPlan(jobName);
                final ExecutorFactory executorFactory =
-                               
executorServiceLoader.getExecutorFactory(configuration);
-
-               final Executor executor = 
executorFactory.getExecutor(configuration);
+                       executorServiceLoader.getExecutorFactory(configuration);
 
-               try (final JobClient jobClient = executor.execute(plan, 
configuration).get()) {
+               checkNotNull(
+                       executorFactory,
+                       "Cannot find compatible factory for current 
environment(%s)",
+                       getClass().getSimpleName());
 
-                       lastJobExecutionResult = 
configuration.getBoolean(DeploymentOptions.ATTACHED)
-                                       ? 
jobClient.getJobExecutionResult(userClassloader).get()
-                                       : new 
DetachedJobExecutionResult(jobClient.getJobID());
+               final Executor executor = 
executorFactory.getExecutor(configuration);
 
-                       return lastJobExecutionResult;
-               }
+               return executor.execute(plan, configuration);
 
 Review comment:
   This is just up to you to integrate if you like it, but I would inline the 
methods:
   
   ```
   return executorFactory
                                .getExecutor(configuration)
                                .execute(plan, configuration);
   ```

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

Reply via email to