From: Bryan Duxbury Date: Wed, 28 Jul 2010 21:30:24 +0000 (+0000) Subject: THRIFT-714. java: maxWorkerThreads parameter to THsHaServer has no effect X-Git-Tag: 0.4.0~40 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=76c2dcc4d3d4497a2ec11fefb4a76087fc5fbf79;p=common%2Fthrift.git THRIFT-714. java: maxWorkerThreads parameter to THsHaServer has no effect This patch removes the non-functioning maxWorkerThreads option and renames minWorkerThreads to workerThreads. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@980234 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/org/apache/thrift/server/THsHaServer.java b/lib/java/src/org/apache/thrift/server/THsHaServer.java index 933ab179..a4ba8d92 100644 --- a/lib/java/src/org/apache/thrift/server/THsHaServer.java +++ b/lib/java/src/org/apache/thrift/server/THsHaServer.java @@ -42,10 +42,9 @@ public class THsHaServer extends TNonblockingServer { // for the passing of Invocations from the Selector to workers. private ExecutorService invoker; - protected final int MIN_WORKER_THREADS; - protected final int MAX_WORKER_THREADS; - protected final int STOP_TIMEOUT_VAL; - protected final TimeUnit STOP_TIMEOUT_UNIT; + protected final int worker_threads; + protected final int stop_timeout_val; + protected final TimeUnit stop_timeout_unit; /** * Create server with given processor, and server transport. Default server @@ -202,10 +201,9 @@ public class THsHaServer extends TNonblockingServer { inputProtocolFactory, outputProtocolFactory, options); - MIN_WORKER_THREADS = options.minWorkerThreads; - MAX_WORKER_THREADS = options.maxWorkerThreads; - STOP_TIMEOUT_VAL = options.stopTimeoutVal; - STOP_TIMEOUT_UNIT = options.stopTimeoutUnit; + worker_threads = options.workerThreads; + stop_timeout_val = options.stopTimeoutVal; + stop_timeout_unit = options.stopTimeoutUnit; } /** @inheritDoc */ @@ -239,8 +237,8 @@ public class THsHaServer extends TNonblockingServer { protected boolean startInvokerPool() { // start the invoker pool LinkedBlockingQueue queue = new LinkedBlockingQueue(); - invoker = new ThreadPoolExecutor(MIN_WORKER_THREADS, MAX_WORKER_THREADS, - STOP_TIMEOUT_VAL, STOP_TIMEOUT_UNIT, queue); + invoker = new ThreadPoolExecutor(worker_threads, worker_threads, + stop_timeout_val, stop_timeout_unit, queue); return true; } @@ -295,8 +293,7 @@ public class THsHaServer extends TNonblockingServer { } public static class Options extends TNonblockingServer.Options { - public int minWorkerThreads = 5; - public int maxWorkerThreads = Integer.MAX_VALUE; + public int workerThreads = 5; public int stopTimeoutVal = 60; public TimeUnit stopTimeoutUnit = TimeUnit.SECONDS; }