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 |
tim |
1.3 |
* A handler for tasks that cannot be executed by a {@link ThreadPoolExecutor}. |
11 |
dl |
1.1 |
* |
12 |
|
|
* @since 1.5 |
13 |
|
|
* |
14 |
|
|
* @spec JSR-166 |
15 |
tim |
1.3 |
* @revised $Date: 2003/06/24 14:34:48 $ |
16 |
dl |
1.2 |
* @editor $Author: dl $ |
17 |
|
|
* @author Doug Lea |
18 |
dl |
1.1 |
*/ |
19 |
|
|
public interface RejectedExecutionHandler { |
20 |
tim |
1.3 |
|
21 |
dl |
1.1 |
/** |
22 |
|
|
* Method invoked by <tt>ThreadPoolExecutor</tt> when |
23 |
|
|
* <tt>execute</tt> cannot submit a task. This may occur when no |
24 |
|
|
* more threads or queue slots are available because their bounds |
25 |
|
|
* would be exceeded, or upon shutdown of the Executor. |
26 |
|
|
* |
27 |
|
|
* In the absence other alternatives, the method may throw an |
28 |
|
|
* unchecked <tt>RejectedExecutionException</tt>, which will be |
29 |
|
|
* propagated to the caller of <tt>execute</tt>. |
30 |
|
|
* |
31 |
|
|
* @param r the runnable task requested to be executed |
32 |
|
|
* @param executor the executor attempting to execute this task |
33 |
|
|
* @throws RejectedExecutionException if there is no remedy |
34 |
|
|
*/ |
35 |
|
|
void rejectedExecution(Runnable r, ThreadPoolExecutor executor); |
36 |
|
|
} |