Github user mxm commented on a diff in the pull request: https://github.com/apache/flink/pull/2313#discussion_r75907814 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/client/JobClient.java --- @@ -243,46 +247,46 @@ public static JobExecutionResult awaitJobResult(JobListeningContext listeningCon final JobID jobID = listeningContext.getJobID(); final ActorRef jobClientActor = listeningContext.getJobClientActor(); final Future<Object> jobSubmissionFuture = listeningContext.getJobResultFuture(); + final FiniteDuration askTimeout = listeningContext.getTimeout(); // retrieves class loader if necessary final ClassLoader classLoader = listeningContext.getClassLoader(); + // wait for the future which holds the result to be ready + // ping the JobClientActor from time to time to check if it is still running while (!jobSubmissionFuture.isCompleted()) { try { - Thread.sleep(250); - } catch (InterruptedException e) { - throw new JobExecutionException(jobID, "Interrupted while waiting for execution result.", e); - } - - try { - Await.result( - Patterns.ask( - jobClientActor, - JobClientMessages.getPing(), - Timeout.durationToTimeout(AkkaUtils.getDefaultTimeout())), - AkkaUtils.getDefaultTimeout()); + Await.ready(jobSubmissionFuture, askTimeout); } catch (Exception e) { --- End diff -- Ah, I thought you were commenting on the inner catch block. Yes, it makes sense to catch only `TimeoutException` and `InterruptedException` here for `Await.ready`. `Await.result` actually throws Exception.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---