HBASE-8988 Reuse the thread pool in the shell to not run out of threads

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2013-07-18 20:23:36 +00:00
parent 521f17f275
commit 018b22366d
1 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,8 @@ module Hbase
class Table class Table
include HBaseConstants include HBaseConstants
@@thread_pool = nil
# Add the command 'name' to table s.t. the shell command also called via 'name' # Add the command 'name' to table s.t. the shell command also called via 'name'
# and has an internal method also called 'name'. # and has an internal method also called 'name'.
# #
@ -110,7 +112,12 @@ EOF
attr_reader :name attr_reader :name
def initialize(configuration, table_name, shell) def initialize(configuration, table_name, shell)
if @@thread_pool then
@table = org.apache.hadoop.hbase.client.HTable.new(configuration, table_name.to_java_bytes, @@thread_pool)
else
@table = org.apache.hadoop.hbase.client.HTable.new(configuration, table_name) @table = org.apache.hadoop.hbase.client.HTable.new(configuration, table_name)
@@thread_pool = @table.getPool()
end
@name = table_name @name = table_name
@shell = shell @shell = shell
@converters = Hash.new() @converters = Hash.new()