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 933ab17..a4ba8d9 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 @@
// 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 @@
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 @@
protected boolean startInvokerPool() {
// start the invoker pool
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
- 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 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;
}