summaryrefslogtreecommitdiffstats
path: root/luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java
diff options
context:
space:
mode:
Diffstat (limited to 'luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java')
-rw-r--r--luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java b/luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java
index 6622af8..331e225 100644
--- a/luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java
+++ b/luni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java
@@ -1,7 +1,7 @@
/*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
@@ -9,6 +9,10 @@ import java.util.concurrent.locks.*;
import java.util.concurrent.atomic.*;
import java.util.*;
+// BEGIN android-note
+// removed security manager docs
+// END android-note
+
/**
* An {@link ExecutorService} that executes each submitted task using
* one of possibly several pooled threads, normally configured
@@ -1311,8 +1315,6 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* <p>This method does not wait for previously submitted tasks to
* complete execution. Use {@link #awaitTermination awaitTermination}
* to do that.
- *
- * @throws SecurityException {@inheritDoc}
*/
public void shutdown() {
final ReentrantLock mainLock = this.mainLock;
@@ -1342,8 +1344,6 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* processing actively executing tasks. This implementation
* cancels tasks via {@link Thread#interrupt}, so any task that
* fails to respond to interrupts may never terminate.
- *
- * @throws SecurityException {@inheritDoc}
*/
public List<Runnable> shutdownNow() {
List<Runnable> tasks;
@@ -1512,6 +1512,18 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
}
/**
+ * 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.