hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-13112 quota.rb, security.rb and visibility_labels.rb leak connection (Ashish Singhi)
Date Fri, 27 Feb 2015 05:59:26 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 ac7faf3ef -> 0ff1418b3


HBASE-13112 quota.rb, security.rb and visibility_labels.rb leak connection (Ashish Singhi)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0ff1418b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0ff1418b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0ff1418b

Branch: refs/heads/branch-1
Commit: 0ff1418b32fc490993e20c51ff85879d2406ea75
Parents: ac7faf3
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Feb 26 21:59:20 2015 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Feb 26 21:59:20 2015 -0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/hbase.rb             |  4 ++--
 hbase-shell/src/main/ruby/hbase/security.rb          | 11 +++++++----
 hbase-shell/src/main/ruby/hbase/visibility_labels.rb | 13 +++++++------
 3 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0ff1418b/hbase-shell/src/main/ruby/hbase/hbase.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/hbase.rb b/hbase-shell/src/main/ruby/hbase/hbase.rb
index ca3e90c..89700a4 100644
--- a/hbase-shell/src/main/ruby/hbase/hbase.rb
+++ b/hbase-shell/src/main/ruby/hbase/hbase.rb
@@ -56,11 +56,11 @@ module Hbase
     end
 
     def security_admin(formatter)
-      ::Hbase::SecurityAdmin.new(configuration, formatter)
+      ::Hbase::SecurityAdmin.new(@connection.getAdmin, formatter)
     end
 
     def visibility_labels_admin(formatter)
-      ::Hbase::VisibilityLabelsAdmin.new(configuration, formatter)
+      ::Hbase::VisibilityLabelsAdmin.new(@connection.getAdmin, formatter)
     end
 
     def shutdown

http://git-wip-us.apache.org/repos/asf/hbase/blob/0ff1418b/hbase-shell/src/main/ruby/hbase/security.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb
index 5262f45..bfdd733 100644
--- a/hbase-shell/src/main/ruby/hbase/security.rb
+++ b/hbase-shell/src/main/ruby/hbase/security.rb
@@ -24,13 +24,16 @@ module Hbase
   class SecurityAdmin
     include HBaseConstants
 
-    def initialize(configuration, formatter)
-      @config = configuration
-      @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(@config)
-      @admin = @connection.getAdmin()
+    def initialize(admin, formatter)
+      @admin = admin
+      @config = @admin.getConfiguration()
       @formatter = formatter
     end
 
+    def close
+      @admin.close
+    end
+
     #----------------------------------------------------------------------------------------------
     def grant(user, permissions, table_name=nil, family=nil, qualifier=nil)
       security_available?

http://git-wip-us.apache.org/repos/asf/hbase/blob/0ff1418b/hbase-shell/src/main/ruby/hbase/visibility_labels.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/visibility_labels.rb b/hbase-shell/src/main/ruby/hbase/visibility_labels.rb
index 61a49e8..a3f8b1a 100644
--- a/hbase-shell/src/main/ruby/hbase/visibility_labels.rb
+++ b/hbase-shell/src/main/ruby/hbase/visibility_labels.rb
@@ -24,13 +24,14 @@ java_import org.apache.hadoop.hbase.util.Bytes
 module Hbase
   class VisibilityLabelsAdmin
 
-    def initialize(configuration, formatter)
-      @config = configuration
+    def initialize(admin, formatter)
+      @admin = admin
+      @config = @admin.getConfiguration()
       @formatter = formatter
-      
-      # @connection = org.apache.hadoop.hbase.client.ConnectionFactory(configuration)
-      # @admin = @connection.getAdmin()
-      @admin = org.apache.hadoop.hbase.client.HBaseAdmin.new(configuration)
+    end
+
+    def close
+      @admin.close
     end
 
     def add_labels(*args)


Mime
View raw message