TisonKun commented on a change in pull request #10311: [FLINK-14762][client] 
Enrich JobClient API
URL: https://github.com/apache/flink/pull/10311#discussion_r351866611
 
 

 ##########
 File path: 
flink-clients/src/main/java/org/apache/flink/client/deployment/AbstractJobClusterExecutor.java
 ##########
 @@ -66,7 +68,41 @@ public AbstractJobClusterExecutor(@Nonnull final 
ClientFactory clusterClientFact
                        LOG.info("Job has been submitted with JobID " + 
jobGraph.getJobID());
 
                        final boolean withShutdownHook = 
!configAccessor.getDetachedMode() && configAccessor.isShutdownOnAttachedExit();
-                       return CompletableFuture.completedFuture(new 
ClusterClientJobClientAdapter<>(clusterClient, jobGraph.getJobID(), 
withShutdownHook));
+
+                       if (withShutdownHook) {
+                               Thread shutdownHook = 
ShutdownHookUtil.addShutdownHook(
+                                       clusterClient::shutDownCluster, 
clusterClient.getClass().getSimpleName(), LOG);
+
+                               return CompletableFuture.completedFuture(new 
ClusterClientJobClientAdapter<ClusterID>(clusterClient, jobGraph.getJobID()) {
+                                       @Override
+                                       public void doClose() {
+                                               Throwable throwable = null;
+
+                                               try {
 
 Review comment:
   After a close look I think it makes sense we close client as
   
   ```java
   ShutdownHookUtil.removeShutdownHook(shutdownHook, 
clusterClient.getClass().getSimpleName(), LOG);
   clusterClient.close();
   ```
   
   for unchecked exception is unhandled.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to