svn commit: r1139696 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1139696 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java

doogie-3
Author: doogie
Date: Sun Jun 26 02:50:23 2011
New Revision: 1139696

URL: http://svn.apache.org/viewvc?rev=1139696&view=rev
Log:
FEATURE: Add a flag to getExecutor that specifies whether to prestart
the threads in the pool.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=1139696&r1=1139695&r2=1139696&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java Sun Jun 26 02:50:23 2011
@@ -52,10 +52,17 @@ public final class ExecutionPool {
         return new ExecutionPoolThreadFactory(namePrefix);
     }
 
+    @Deprecated
     public static ScheduledExecutorService getExecutor(String namePrefix, int threadCount) {
+        return getExecutor(namePrefix, threadCount, true);
+    }
+
+    public static ScheduledExecutorService getExecutor(String namePrefix, int threadCount, boolean preStart) {
         ThreadFactory threadFactory = createThreadFactory(namePrefix);
         ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(threadCount, threadFactory);
-        executor.prestartAllCoreThreads();
+        if (preStart) {
+            executor.prestartAllCoreThreads();
+        }
         return executor;
     }