You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/12/03 01:02:57 UTC

[27/50] [abbrv] thrift git commit: 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

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


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/847ecf3c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/847ecf3c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/847ecf3c

Branch: refs/heads/0.11.0
Commit: 847ecf3c1de8b297d6a29305b9f7871fcf609c36
Parents: a533ea1
Author: itegel <it...@gmail.com>
Authored: Mon Oct 30 19:09:21 2017 +0800
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 2 05:53:09 2017 -0700

----------------------------------------------------------------------
 .../src/org/apache/thrift/server/TThreadPoolServer.java  | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/847ecf3c/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
----------------------------------------------------------------------
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 @@ 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) {