You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/07/07 23:03:51 UTC

[GitHub] [iceberg] kbendick commented on a change in pull request #2785: Fix the problem that the metastore-client is not closed

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



##########
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());

Review comment:
       Nit: Would this be better as a lower log level? Additionally, would it make more sense to format this as human readable / formatted text as opposed to references to functions (which might be awkward for end users)?
   
   For example: `The CachedClientPool has a size of {}`.

##########
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:
       Do we need to check if `close` has already been called and/or if the result of calling `clientPool()` is not null?




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org