You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by me...@apache.org on 2024/02/13 10:25:45 UTC

(hbase) branch branch-2.4 updated: HBASE-28353 Close HBase connection on implicit exit from HBase shell (#5673)

This is an automated email from the ASF dual-hosted git repository.

meszibalu pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 6006eba90ff HBASE-28353 Close HBase connection on implicit exit from HBase shell (#5673)
6006eba90ff is described below

commit 6006eba90ff946884620c749c44123816fe779ab
Author: Istvan Toth <st...@apache.org>
AuthorDate: Tue Feb 13 11:21:01 2024 +0100

    HBASE-28353 Close HBase connection on implicit exit from HBase shell (#5673)
    
    Signed-off-by: Bryan Beaudreault <bb...@apache.org>
    Signed-off-by: Balazs Meszaros <me...@apache.org>
---
 hbase-shell/src/main/ruby/shell.rb | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hbase-shell/src/main/ruby/shell.rb b/hbase-shell/src/main/ruby/shell.rb
index da9f27fe848..806d399f40b 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -108,11 +108,6 @@ module Shell
     # exit the interactive shell and save that this
     # happend via a call to exit
     def exit(ret = 0)
-      # Non-deamon Netty threadpool in ZK ClientCnxnSocketNetty cannot be shut down otherwise
-      begin
-        hbase.shutdown
-      rescue Exception
-      end
       @exit_code = ret
       IRB.irb_exit(IRB.CurrentContext.irb, ret)
     end
@@ -323,6 +318,13 @@ For more on the HBase Shell, see http://hbase.apache.org/book.html
       hbase_receiver.send :define_singleton_method, :exit, lambda { |rc = 0|
         @shell.exit(rc)
       }
+      at_exit do
+        # Non-deamon Netty threadpool in ZK ClientCnxnSocketNetty cannot be shut down otherwise
+        begin
+          hbase.shutdown
+        rescue Exception
+        end
+      end
       ::IRB::WorkSpace.new(hbase_receiver.get_binding)
     end