wangyang0918 commented on a change in pull request #15385:
URL: https://github.com/apache/flink/pull/15385#discussion_r604575274



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClient.java
##########
@@ -342,7 +367,22 @@ public KubernetesWatch watchConfigMaps(
 
     @Override
     public void close() {
+        synchronized (LOCK) {
+            final Tuple2<Fabric8FlinkKubeClient, Integer> cachedClient = 
CACHE.get(cacheKey);
+            if (cachedClient != null) {
+                if (--cachedClient.f1 == 0) {
+                    cachedClient.f0.internalClose();
+                    CACHE.remove(cacheKey);
+                }
+            } else {
+                internalClose();
+            }

Review comment:
       If you really think this is not a correct behavior(instantiating 
`Fabric8FlinkKubeClient` does not use the `CACHE`), I could make the 
constructor `private`.




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


Reply via email to