diff options
author | itegel <itegel@gmail.com> | 2017-10-30 19:09:21 +0800 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2017-11-02 05:53:09 -0700 |
commit | 847ecf3c1de8b297d6a29305b9f7871fcf609c36 (patch) | |
tree | fd4600d29d5a8f22f9c81268b0d955b87535894a | |
parent | a533ea1615e9df935e77b99440cf264c6b417e3e (diff) | |
download | thrift-847ecf3c1de8b297d6a29305b9f7871fcf609c36.tar.gz |
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
-rw-r--r-- | lib/java/src/org/apache/thrift/server/TThreadPoolServer.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java index 0529d72bf..90d5e5b04 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 @@ public class TThreadPoolServer extends TServer { return this; } + public Args stopTimeoutUnit(TimeUnit tu) { + stopTimeoutUnit = tu; + return this; + } + public Args requestTimeout(int n) { requestTimeout = n; return this; @@ -136,7 +141,7 @@ public class TThreadPoolServer extends TServer { return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, - TimeUnit.SECONDS, + args.stopTimeoutUnit, executorQueue); } @@ -269,7 +274,7 @@ public class TThreadPoolServer extends TServer { 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 @@ public class TThreadPoolServer extends TServer { } } } 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) { |