/*
* @(#)CannotExecuteHandler.java
*/
package java.util.concurrent;
/**
* A handler for tasks that cannot be executed by a {@link ThreadedExecutor}.
*
* @since 1.5
*
* @spec JSR-166
* @revised $Date: 2003/05/27 18:10:09 $
* @editor $Author: jozart $
*/
public interface CannotExecuteHandler {
/**
* Method invoked by ThreadedExecutor when execute cannot
* submit a task. This may occur when no more threads or queue slots are
* available because their bounds would be exceeded, or upon
* shutdown of the Executor. The isShutdown parameter can be
* used to distinguish between these cases.
*
* Returns false if execute should be retried, else true.
* You may alternatively throw an unchecked CannotExecuteException,
* which will be propagated to the caller of execute.
*
* @param r the runnable task requested to be executed
* @param isShutdown true if the ThreadExecutor has been shutdown
* @return false if execute should be retried, else true
* @throws CannotExecuteException if there is no remedy
*/
boolean cannotExecute(Runnable r, boolean isShutdown);
}