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

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


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

commit 8246e85a567fcd176938f05fad07ec02e289c5e3
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 <bbeaudrea...@apache.org>
    Signed-off-by: Balazs Meszaros <meszib...@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
 

Reply via email to