HBASE-4970 Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1220626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2011-12-19 06:57:08 +00:00
parent d9c8e9954a
commit 818adb795b
2 changed files with 8 additions and 1 deletions

View File

@ -833,6 +833,11 @@ Release 0.92.0 - Unreleased
HBASE-2742 Provide strong authentication with a secure RPC engine HBASE-2742 Provide strong authentication with a secure RPC engine
HBASE-3025 Coprocessor based access control HBASE-3025 Coprocessor based access control
Release 0.90.6 - Unreleased
BUG FIXES
HBASE-4970 Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)
Release 0.90.5 - Unreleased Release 0.90.5 - Unreleased
BUG FIXES BUG FIXES

View File

@ -169,12 +169,14 @@ public class HTable implements HTableInterface, Closeable {
if (maxThreads == 0) { if (maxThreads == 0) {
maxThreads = 1; // is there a better default? maxThreads = 1; // is there a better default?
} }
long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime", 60);
// Using the "direct handoff" approach, new threads will only be created // Using the "direct handoff" approach, new threads will only be created
// if it is necessary and will grow unbounded. This could be bad but in HCM // if it is necessary and will grow unbounded. This could be bad but in HCM
// we only create as many Runnables as there are region servers. It means // we only create as many Runnables as there are region servers. It means
// it also scales when new region servers are added. // it also scales when new region servers are added.
this.pool = new ThreadPoolExecutor(1, maxThreads, this.pool = new ThreadPoolExecutor(1, maxThreads,
60, TimeUnit.SECONDS, keepAliveTime, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), new SynchronousQueue<Runnable>(),
new DaemonThreadFactory()); new DaemonThreadFactory());
((ThreadPoolExecutor)this.pool).allowCoreThreadTimeOut(true); ((ThreadPoolExecutor)this.pool).allowCoreThreadTimeOut(true);