1 |
dl |
1.1 |
/* |
2 |
|
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
|
* Expert Group and released to the public domain. Use, modify, and |
4 |
|
|
* redistribute this code in any way without acknowledgement. |
5 |
|
|
*/ |
6 |
|
|
|
7 |
|
|
package java.util.concurrent; |
8 |
|
|
|
9 |
|
|
/** |
10 |
|
|
* A handler for tasks that cannot be executed by a {@link ThreadedExecutor}. |
11 |
|
|
* |
12 |
|
|
* @since 1.5 |
13 |
|
|
* |
14 |
|
|
* @spec JSR-166 |
15 |
|
|
* @revised $Date: 2003/02/26 10:48:09 $ |
16 |
|
|
* @editor $Author: jozart $ |
17 |
|
|
*/ |
18 |
|
|
public interface RejectedExecutionHandler { |
19 |
|
|
|
20 |
|
|
/** |
21 |
|
|
* Method invoked by <tt>ThreadPoolExecutor</tt> when |
22 |
|
|
* <tt>execute</tt> cannot submit a task. This may occur when no |
23 |
|
|
* more threads or queue slots are available because their bounds |
24 |
|
|
* would be exceeded, or upon shutdown of the Executor. |
25 |
|
|
* |
26 |
|
|
* In the absence other alternatives, the method may throw an |
27 |
|
|
* unchecked <tt>RejectedExecutionException</tt>, which will be |
28 |
|
|
* propagated to the caller of <tt>execute</tt>. |
29 |
|
|
* |
30 |
|
|
* @param r the runnable task requested to be executed |
31 |
|
|
* @param executor the executor attempting to execute this task |
32 |
|
|
* @throws RejectedExecutionException if there is no remedy |
33 |
|
|
*/ |
34 |
|
|
void rejectedExecution(Runnable r, ThreadPoolExecutor executor); |
35 |
|
|
} |