1 |
/* |
2 |
* @(#)CannotExecuteHandler.java |
3 |
*/ |
4 |
|
5 |
package java.util.concurrent; |
6 |
|
7 |
/** |
8 |
* A handler for tasks that cannot be executed by a {@link ThreadedExecutor}. |
9 |
* |
10 |
* @since 1.5 |
11 |
* |
12 |
* @spec JSR-166 |
13 |
* @revised $Date: 2003/05/14 21:30:45 $ |
14 |
* @editor $Author: tim $ |
15 |
*/ |
16 |
public interface CannotExecuteHandler { |
17 |
|
18 |
/** |
19 |
* Method invoked by <tt>ThreadedExecutor</tt> when <tt>execute</tt> cannot |
20 |
* submit a 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. The <tt>isShutdown</tt> parameter can be |
23 |
* used to distinguish between these cases. |
24 |
* |
25 |
* Returns false if <tt>execute</tt> should be retried, else true. |
26 |
* You may alternatively throw an unchecked <tt>CannotExecuteException</tt>, |
27 |
* which will be propagated to the caller of <tt>execute</tt>. |
28 |
* |
29 |
* @param r the runnable task requested to be executed |
30 |
* @param isShutdown true if the ThreadExecutor has been shutdown |
31 |
* @return false if <tt>execute</tt> should be retried, else true |
32 |
* @throws CannotExecuteException if there is no remedy |
33 |
*/ |
34 |
boolean cannotExecute(Runnable r, boolean isShutdown); |
35 |
} |