jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
changeset 10609 0caee7f44e7b
parent 9242 ef138d47df58
child 16079 7252530399e2
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Wed Sep 21 23:22:11 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Fri Sep 23 14:24:04 2011 +0100
@@ -1546,6 +1546,18 @@
     }
 
     /**
+     * Same as prestartCoreThread except arranges that at least one
+     * thread is started even if corePoolSize is 0.
+     */
+    void ensurePrestart() {
+        int wc = workerCountOf(ctl.get());
+        if (wc < corePoolSize)
+            addWorker(null, true);
+        else if (wc == 0)
+            addWorker(null, false);
+    }
+
+    /**
      * Starts all core threads, causing them to idly wait for work. This
      * overrides the default policy of starting core threads only when
      * new tasks are executed.