You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2011/06/08 16:13:26 UTC

svn commit: r1133410 - /activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java

Author: chirino
Date: Wed Jun  8 14:13:25 2011
New Revision: 1133410

URL: http://svn.apache.org/viewvc?rev=1133410&view=rev
Log:
Tuning the settings for the blocking thread pool.

Modified:
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java?rev=1133410&r1=1133409&r2=1133410&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ApolloThreadPool.java Wed Jun  8 14:13:25 2011
@@ -18,7 +18,10 @@ package org.apache.activemq.apollo.util;
 
 import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.*;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 /**
  * <p>
@@ -30,11 +33,11 @@ import java.util.concurrent.*;
  */
 public class ApolloThreadPool {
 
-    public static final int POOL_SIZE = Integer.parseInt(System.getProperty("apollo.thread.pool", "128"));
+    private static long stackSize = Long.parseLong(System.getProperty("apollo.thread.stack.size", ""+1024*512));
 
-    public static final ThreadPoolExecutor INSTANCE = new ThreadPoolExecutor(POOL_SIZE, POOL_SIZE, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
+    public static final ThreadPoolExecutor INSTANCE = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new ThreadFactory() {
         public Thread newThread(Runnable r) {
-            Thread rc = new Thread(r, "Apollo Blocking Task");
+            Thread rc = new Thread(null, r, "Apollo Task", stackSize);
             rc.setDaemon(true);
             return rc;
         }
@@ -51,9 +54,4 @@ public class ApolloThreadPool {
             return Collections.emptyList();
         }
     };
-
-    static {
-        INSTANCE.allowCoreThreadTimeOut(true);
-    }
-
 }