THRIFT-4378: add set method for stopTimeoutUnit in TThreadPoolServer java lib
modify timeout unit in createDefaultExecutorService from hard coding to read from args
Client: java
This closes #1409
diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
index 0529d72..90d5e5b 100644
--- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
+++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
@@ -75,6 +75,11 @@
return this;
}
+ public Args stopTimeoutUnit(TimeUnit tu) {
+ stopTimeoutUnit = tu;
+ return this;
+ }
+
public Args requestTimeout(int n) {
requestTimeout = n;
return this;
@@ -136,7 +141,7 @@
return new ThreadPoolExecutor(args.minWorkerThreads,
args.maxWorkerThreads,
args.stopTimeoutVal,
- TimeUnit.SECONDS,
+ args.stopTimeoutUnit,
executorQueue);
}
@@ -269,7 +274,7 @@
inputTransport = inputTransportFactory_.getTransport(client_);
outputTransport = outputTransportFactory_.getTransport(client_);
inputProtocol = inputProtocolFactory_.getProtocol(inputTransport);
- outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
+ outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
eventHandler = getEventHandler();
if (eventHandler != null) {
@@ -288,7 +293,7 @@
}
}
} catch (TSaslTransportException ttx) {
- // Something thats not SASL was in the stream, continue silently
+ // Something thats not SASL was in the stream, continue silently
} catch (TTransportException ttx) {
// Assume the client died and continue silently
} catch (TException tx) {