HBASE-9917 Fix it so Default Connection Pool does not spin up max threads even when not needed

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1540945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-11-12 04:55:30 +00:00
parent f8f0a927e3
commit c3fcaec3f4
1 changed files with 7 additions and 7 deletions

View File

@ -720,22 +720,22 @@ public class HConnectionManager {
synchronized (this) {
if (batchPool == null) {
int maxThreads = conf.getInt("hbase.hconnection.threads.max", 256);
int coreThreads = conf.getInt("hbase.hconnection.threads.core", 0);
if (maxThreads == 0) {
maxThreads = Runtime.getRuntime().availableProcessors() * 8;
}
long keepAliveTime = conf.getLong(
"hbase.hconnection.threads.keepalivetime", 60);
long keepAliveTime = conf.getLong("hbase.hconnection.threads.keepalivetime", 10);
LinkedBlockingQueue<Runnable> workQueue =
new LinkedBlockingQueue<Runnable>(256 *
new LinkedBlockingQueue<Runnable>(maxThreads *
conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS,
HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS));
this.batchPool = new ThreadPoolExecutor(
maxThreads,
coreThreads,
maxThreads,
keepAliveTime,
TimeUnit.SECONDS,
workQueue,
Threads.newDaemonThreadFactory("hbase-connection-shared-executor"));
Threads.newDaemonThreadFactory(toString() + "-shared-"));
}
this.cleanupPool = true;
}