HBASE-13112 quota.rb, security.rb and visibility_labels.rb leak connection (Ashish Singhi)
This commit is contained in:
parent
49b4f3737e
commit
458846ef7b
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue