TisonKun commented on a change in pull request #10474: [FLINK-15116] Make 
JobClient stateless, remove AutoCloseable
URL: https://github.com/apache/flink/pull/10474#discussion_r355085634
 
 

 ##########
 File path: 
flink-clients/src/main/java/org/apache/flink/client/deployment/AbstractJobClusterExecutor.java
 ##########
 @@ -63,29 +64,28 @@ public AbstractJobClusterExecutor(@Nonnull final 
ClientFactory clusterClientFact
 
                        final ClusterSpecification clusterSpecification = 
clusterClientFactory.getClusterSpecification(configuration);
 
-                       final ClusterClient<ClusterID> clusterClient = 
clusterDescriptor.deployJobCluster(clusterSpecification, jobGraph, 
configAccessor.getDetachedMode());
+                       final ClusterClientProvider<ClusterID> 
clusterClientProvider = clusterDescriptor
+                                       .deployJobCluster(clusterSpecification, 
jobGraph, configAccessor.getDetachedMode());
                        LOG.info("Job has been submitted with JobID " + 
jobGraph.getJobID());
 
                        final boolean withShutdownHook = 
!configAccessor.getDetachedMode() && configAccessor.isShutdownOnAttachedExit();
 
                        if (withShutdownHook) {
-                               Thread shutdownHook = 
ShutdownHookUtil.addShutdownHook(
-                                       clusterClient::shutDownCluster, 
clusterClient.getClass().getSimpleName(), LOG);
-
-                               return CompletableFuture.completedFuture(new 
ClusterClientJobClientAdapter<ClusterID>(clusterClient, jobGraph.getJobID()) {
-                                       @Override
-                                       protected void doClose() {
-                                               
ShutdownHookUtil.removeShutdownHook(shutdownHook, 
clusterClient.getClass().getSimpleName(), LOG);
-                                               clusterClient.close();
-                                       }
+                               ShutdownHookUtil.addShutdownHook(
 
 Review comment:
   Now no one remove the shutdown hook.

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