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
|
end
|
||||||
|
|
||||||
def security_admin(formatter)
|
def security_admin(formatter)
|
||||||
::Hbase::SecurityAdmin.new(configuration, formatter)
|
::Hbase::SecurityAdmin.new(@connection.getAdmin, formatter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def visibility_labels_admin(formatter)
|
def visibility_labels_admin(formatter)
|
||||||
::Hbase::VisibilityLabelsAdmin.new(configuration, formatter)
|
::Hbase::VisibilityLabelsAdmin.new(@connection.getAdmin, formatter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def quotas_admin(formatter)
|
def quotas_admin(formatter)
|
||||||
::Hbase::QuotasAdmin.new(configuration, formatter)
|
::Hbase::QuotasAdmin.new(@connection.getAdmin, formatter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def shutdown
|
def shutdown
|
||||||
|
|
|
@ -34,13 +34,15 @@ end
|
||||||
|
|
||||||
module Hbase
|
module Hbase
|
||||||
class QuotasAdmin
|
class QuotasAdmin
|
||||||
def initialize(configuration, formatter)
|
def initialize(admin, formatter)
|
||||||
@config = configuration
|
@admin = admin
|
||||||
@connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration)
|
|
||||||
@admin = @connection.getAdmin()
|
|
||||||
@formatter = formatter
|
@formatter = formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def close
|
||||||
|
@admin.close
|
||||||
|
end
|
||||||
|
|
||||||
def throttle(args)
|
def throttle(args)
|
||||||
raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
|
raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
|
||||||
type = args.fetch(THROTTLE_TYPE, REQUEST)
|
type = args.fetch(THROTTLE_TYPE, REQUEST)
|
||||||
|
|
|
@ -24,13 +24,16 @@ module Hbase
|
||||||
class SecurityAdmin
|
class SecurityAdmin
|
||||||
include HBaseConstants
|
include HBaseConstants
|
||||||
|
|
||||||
def initialize(configuration, formatter)
|
def initialize(admin, formatter)
|
||||||
@config = configuration
|
@admin = admin
|
||||||
@connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(@config)
|
@config = @admin.getConfiguration()
|
||||||
@admin = @connection.getAdmin()
|
|
||||||
@formatter = formatter
|
@formatter = formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def close
|
||||||
|
@admin.close
|
||||||
|
end
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
def grant(user, permissions, table_name=nil, family=nil, qualifier=nil)
|
def grant(user, permissions, table_name=nil, family=nil, qualifier=nil)
|
||||||
security_available?
|
security_available?
|
||||||
|
|
|
@ -24,13 +24,14 @@ java_import org.apache.hadoop.hbase.util.Bytes
|
||||||
module Hbase
|
module Hbase
|
||||||
class VisibilityLabelsAdmin
|
class VisibilityLabelsAdmin
|
||||||
|
|
||||||
def initialize(configuration, formatter)
|
def initialize(admin, formatter)
|
||||||
@config = configuration
|
@admin = admin
|
||||||
|
@config = @admin.getConfiguration()
|
||||||
@formatter = formatter
|
@formatter = formatter
|
||||||
|
end
|
||||||
# @connection = org.apache.hadoop.hbase.client.ConnectionFactory(configuration)
|
|
||||||
# @admin = @connection.getAdmin()
|
def close
|
||||||
@admin = org.apache.hadoop.hbase.client.HBaseAdmin.new(configuration)
|
@admin.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_labels(*args)
|
def add_labels(*args)
|
||||||
|
|
Loading…
Reference in New Issue