1 |
dl |
1.1 |
/* |
2 |
|
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
dl |
1.5 |
* Expert Group and released to the public domain, as explained at |
4 |
jsr166 |
1.8 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
dl |
1.1 |
*/ |
6 |
|
|
|
7 |
|
|
package java.util.concurrent; |
8 |
|
|
|
9 |
|
|
/** |
10 |
jsr166 |
1.7 |
* A handler for tasks that cannot be executed by a {@link ThreadPoolExecutor}. |
11 |
dl |
1.1 |
* |
12 |
|
|
* @since 1.5 |
13 |
dl |
1.2 |
* @author Doug Lea |
14 |
dl |
1.1 |
*/ |
15 |
|
|
public interface RejectedExecutionHandler { |
16 |
tim |
1.3 |
|
17 |
dl |
1.1 |
/** |
18 |
dl |
1.4 |
* Method that may be invoked by a {@link ThreadPoolExecutor} when |
19 |
jsr166 |
1.7 |
* {@link ThreadPoolExecutor#execute execute} cannot accept a |
20 |
|
|
* task. This may occur when no more threads or queue slots are |
21 |
|
|
* available because their bounds would be exceeded, or upon |
22 |
|
|
* shutdown of the Executor. |
23 |
dl |
1.1 |
* |
24 |
jsr166 |
1.7 |
* <p>In the absence of other alternatives, the method may throw |
25 |
|
|
* an unchecked {@link RejectedExecutionException}, which will be |
26 |
|
|
* propagated to the caller of {@code execute}. |
27 |
dl |
1.1 |
* |
28 |
|
|
* @param r the runnable task requested to be executed |
29 |
|
|
* @param executor the executor attempting to execute this task |
30 |
|
|
* @throws RejectedExecutionException if there is no remedy |
31 |
|
|
*/ |
32 |
|
|
void rejectedExecution(Runnable r, ThreadPoolExecutor executor); |
33 |
|
|
} |