Github user GJL commented on a diff in the pull request: https://github.com/apache/flink/pull/5437#discussion_r168461190 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/MiniDispatcher.java --- @@ -100,6 +101,18 @@ public MiniDispatcher( return acknowledgeCompletableFuture; } + @Override + public CompletableFuture<JobResult> requestJobResult(JobID jobId, Time timeout) { + final CompletableFuture<JobResult> jobResultFuture = super.requestJobResult(jobId, timeout); + + if (executionMode == ClusterEntrypoint.ExecutionMode.NORMAL) { + // terminate the MiniDispatcher once we served the first JobResult successfully + jobResultFuture.thenRun(this::shutDown); --- End diff -- Don't know if it is a problem but if the future is completed exceptionally, `shutDown` will not be invoked. public static void main(String[] args) { FutureUtils.completedExceptionally(new RuntimeException()).thenRun(() -> System.out.println("not printed")); }
---