RejectedExecutionHandler | java.util.concurrent |
This interface defines an API for a handler
method invoked by a ThreadPoolExecutor when its
execute( ) method cannot accept any more
Runnable objects. This can occur when both the
thread pool and the queue of waiting tasks is full, or when the
THReadPoolExecutor has been shut down. Register an
instance of this class with the setRejectedExecutionHandler(
) method of ThreadPoolExecutor.
ThreadPoolExecutor includes several predefined
implementations of this interface as static member classes. If the
rejectedExecution( ) method cannot arrange for the
Runnable to be run and does not wish to simply
discard that task, it should throw a
RejectedExecutionException which propagates up to
the caller that submitted the task for execution.
public interface RejectedExecutionHandler {
// Public Instance Methods
void rejectedExecution(Runnable r, ThreadPoolExecutor executor);
}
Implementations
ThreadPoolExecutor.AbortPolicy,
ThreadPoolExecutor.CallerRunsPolicy,
ThreadPoolExecutor.DiscardOldestPolicy,
ThreadPoolExecutor.DiscardPolicy
Passed To
ScheduledThreadPoolExecutor.ScheduledThreadPoolExecutor(
),
ThreadPoolExecutor.{setRejectedExecutionHandler(
), ThreadPoolExecutor( )}
Returned By
ThreadPoolExecutor.getRejectedExecutionHandler( )
|