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 02:44:30 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 49b4f3737 -> 458846ef7


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/458846ef
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/458846ef
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/458846ef

Branch: refs/heads/master
Commit: 458846ef7b0528cb7952c413694eaf55c5d94342
Parents: 49b4f37
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Feb 26 18:44:19 2015 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Feb 26 18:44:19 2015 -0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/hbase.rb             |  6 +++---
 hbase-shell/src/main/ruby/hbase/quotas.rb            | 10 ++++++----
 hbase-shell/src/main/ruby/hbase/security.rb          | 11 +++++++----
 hbase-shell/src/main/ruby/hbase/visibility_labels.rb | 13 +++++++------
 4 files changed, 23 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/458846ef/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 030c88c..135e1d5 100644
--- a/hbase-shell/src/main/ruby/hbase/hbase.rb
+++ b/hbase-shell/src/main/ruby/hbase/hbase.rb
@@ -57,15 +57,15 @@ 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 quotas_admin(formatter)
-      ::Hbase::QuotasAdmin.new(configuration, formatter)
+      ::Hbase::QuotasAdmin.new(@connection.getAdmin, formatter)
     end
     
     def shutdown

http://git-wip-us.apache.org/repos/asf/hbase/blob/458846ef/hbase-shell/src/main/ruby/hbase/quotas.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/quotas.rb b/hbase-shell/src/main/ruby/hbase/quotas.rb
index 758e2ec..fa076a5 100644
--- a/hbase-shell/src/main/ruby/hbase/quotas.rb
+++ b/hbase-shell/src/main/ruby/hbase/quotas.rb
@@ -34,13 +34,15 @@ end
 
 module Hbase
   class QuotasAdmin
-    def initialize(configuration, formatter)
-      @config = configuration
-      @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration)
-      @admin = @connection.getAdmin()
+    def initialize(admin, formatter)
+      @admin = admin
       @formatter = formatter
     end
 
+    def close
+      @admin.close
+    end
+
     def throttle(args)
       raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
       type = args.fetch(THROTTLE_TYPE, REQUEST)

http://git-wip-us.apache.org/repos/asf/hbase/blob/458846ef/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/458846ef/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