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:24:17 UTC

(hbase) branch branch-2 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
in repository https://gitbox.apache.org/repos/asf/hbase.git


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

commit c51f0f6325956d69a62d363270650d624f297425
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 e7ae41200f4..37bebbdd492 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