southernriver commented on a change in pull request #2785:
URL: https://github.com/apache/iceberg/pull/2785#discussion_r665828962



##########
File path: 
hive-metastore/src/main/java/org/apache/iceberg/hive/CachedClientPool.java
##########
@@ -65,6 +68,14 @@ private synchronized void init() {
               .removalListener((key, value, cause) -> ((HiveClientPool) 
value).close())
               .build();
     }
+    Runtime.getRuntime().addShutdownHook(new Thread() {
+      @Override
+      public void run() {
+        LOG.info("Before clientPool closed, clientPool().getCurrentSize() = 
{}", clientPool().getCurrentSize());
+        clientPool().close();

Review comment:
       The clientPool() should never be null from the code :
   ```
     HiveClientPool clientPool() {
       return clientPoolCache.get(metastoreUri, k -> new 
HiveClientPool(clientPoolSize, conf));
     }
   ```
   And the active connection has  been checked inside function of `close() 
`itself as follow:
   
https://github.com/apache/iceberg/blob/master/core/src/main/java/org/apache/iceberg/ClientPoolImpl.java#L86
   
   




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to