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/05/08 14:53:42 UTC

thrift git commit: THRIFT-4190 Improve C# TThreadPoolServer defaults Client: C# Patch: Jens Geyer

Repository: thrift
Updated Branches:
  refs/heads/master c54a90d12 -> 224c334e5


THRIFT-4190 Improve C# TThreadPoolServer defaults
Client: C#
Patch: Jens Geyer

This closes #1262


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

Branch: refs/heads/master
Commit: 224c334e50a553504385dd001dadf31f7346b30a
Parents: c54a90d
Author: Jens Geyer <je...@apache.org>
Authored: Sat May 6 22:38:43 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Mon May 8 16:53:15 2017 +0200

----------------------------------------------------------------------
 lib/csharp/src/Server/TThreadPoolServer.cs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/224c334e/lib/csharp/src/Server/TThreadPoolServer.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Server/TThreadPoolServer.cs b/lib/csharp/src/Server/TThreadPoolServer.cs
index f0c7fe4..0010ece 100644
--- a/lib/csharp/src/Server/TThreadPoolServer.cs
+++ b/lib/csharp/src/Server/TThreadPoolServer.cs
@@ -87,13 +87,19 @@ namespace Thrift.Server
     {
       lock (typeof(TThreadPoolServer))
       {
-        if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+        if(maxThreadPoolThreads > 0)
         {
-          throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+          if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+          {
+            throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+          }
         }
-        if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+        if (minThreadPoolThreads > 0)
         {
-          throw new Exception("Error: could not SetMinThreads in ThreadPool");
+          if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+          {
+            throw new Exception("Error: could not SetMinThreads in ThreadPool");
+          }
         }
       }
     }