Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/4742#discussion_r142897184 --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java --- @@ -610,25 +633,15 @@ public void cancel(JobID jobId) throws Exception { * failed. That might be due to an I/O problem, ie, the job-manager is unreachable. */ public void stop(final JobID jobId) throws Exception { - final ActorGateway jobManagerGateway = getJobManagerGateway(); + final ActorGateway jobManager = getJobManagerGateway(); - final Future<Object> response; - try { - response = jobManagerGateway.ask(new JobManagerMessages.StopJob(jobId), timeout); - } catch (final Exception e) { - throw new ProgramInvocationException("Failed to query the job manager gateway.", e); - } + Future<Object> response = jobManager.ask(new JobManagerMessages.StopJob(jobId), timeout); - final Object result = Await.result(response, timeout); + final Object rc = Await.result(response, timeout); - if (result instanceof JobManagerMessages.StoppingSuccess) { - log.info("Job stopping with ID " + jobId + " succeeded."); - } else if (result instanceof JobManagerMessages.StoppingFailure) { - final Throwable t = ((JobManagerMessages.StoppingFailure) result).cause(); - log.info("Job stopping with ID " + jobId + " failed.", t); - throw new Exception("Failed to stop the job because of \n" + t.getMessage()); - } else { - throw new Exception("Unknown message received while stopping: " + result.getClass().getName()); + if (rc instanceof JobManagerMessages.StoppingFailure) { + throw new Exception("Stopping the job with ID " + jobId + " failed.", + ((JobManagerMessages.StoppingFailure) rc).cause()); --- End diff -- The unknown response type exception was lost
---