THRIFT-1584 could not SetMinThreads in ThreadPool on single-core machines
authorJens Geyer <jensg@apache.org>
Wed, 28 May 2014 20:31:23 +0000 (22:31 +0200)
committerJens Geyer <jensg@apache.org>
Wed, 28 May 2014 20:35:15 +0000 (22:35 +0200)
Client: C#
Patch: Jens Geyer after suggestion from JIRA-User "Funny"

lib/csharp/src/Server/TThreadPoolServer.cs

index b257fd8..7ddabf7 100644 (file)
@@ -75,16 +75,16 @@ namespace Thrift.Server
                        :base(processor, serverTransport, inputTransportFactory, outputTransportFactory,
                                  inputProtocolFactory, outputProtocolFactory, logDel)
                {
-      lock (typeof(TThreadPoolServer))
-      {
-        if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
-        {
-          throw new Exception("Error: could not SetMinThreads in ThreadPool");
-        }
-        if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
-        {
-          throw new Exception("Error: could not SetMaxThreads in ThreadPool");
-        }
+                       lock (typeof(TThreadPoolServer))
+                       {
+                               if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+                               {
+                                       throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+                               }
+                               if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+                               {
+                                       throw new Exception("Error: could not SetMinThreads in ThreadPool");
+                               }
                        }
                }