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

 ##########
 File path: 
flink-clients/src/main/java/org/apache/flink/client/deployment/ClusterClientJobClientAdapter.java
 ##########
 @@ -87,10 +113,19 @@ public JobID getJobID() {
        }
 
        @Override
-       public void close() throws Exception {
-               if (shutdownHook != null) {
-                       ShutdownHookUtil.removeShutdownHook(shutdownHook, 
clusterClient.getClass().getSimpleName(), LOG);
+       public final void close() {
+               if (running.compareAndSet(true, false)) {
+                       doClose();
                }
-               this.clusterClient.close();
+       }
+
+       /**
+        * Method to be override by subclass which contains actual close 
actions.
+        *
+        * <p>We do close in this way to ensure multiple calls to {@link 
#close()}
+        * are executed at most once guarded by {@link #running} flag.
+        */
+       public void doClose() {
 
 Review comment:
   Should this be `protected`?

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