zhuzhurk commented on a change in pull request #9788: [FLINK-14259] Introduce 
JobManagerRunner interface
URL: https://github.com/apache/flink/pull/9788#discussion_r329311040
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
 ##########
 @@ -378,14 +379,14 @@ private boolean isPartialResourceConfigured(JobGraph 
jobGraph) {
        }
 
        private JobManagerRunner startJobManagerRunner(JobManagerRunner 
jobManagerRunner) throws Exception {
-               final JobID jobId = jobManagerRunner.getJobGraph().getJobID();
+               final JobID jobId = jobManagerRunner.getJobID();
 
                FutureUtils.assertNoException(
                        jobManagerRunner.getResultFuture().handleAsync(
                                (ArchivedExecutionGraph archivedExecutionGraph, 
Throwable throwable) -> {
                                        // check if we are still the active 
JobManagerRunner by checking the identity
-                                       final 
CompletableFuture<JobManagerRunner> jobManagerRunnerFuture = 
jobManagerRunnerFutures.get(jobId);
-                                       final JobManagerRunner 
currentJobManagerRunner = jobManagerRunnerFuture != null ? 
jobManagerRunnerFuture.getNow(null) : null;
+                                       final 
Optional<CompletableFuture<JobManagerRunner>> optionalJobManagerRunner = 
Optional.ofNullable(jobManagerRunnerFutures.get(jobId));
+                                       final JobManagerRunner 
currentJobManagerRunner = optionalJobManagerRunner.map(future -> 
future.getNow(null)).orElse(null);
 
 Review comment:
   How about merging above 2 lines in one statement as they look on one chain 
already?

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