1 /* 2 * @(#)RejectedExecutionHandler.java 1.3 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.util.concurrent; 9 10 /** 11 * A handler for tasks that cannot be executed by a {@link 12 * ThreadPoolExecutor}. 13 * 14 * @since 1.5 15 * @author Doug Lea 16 */ 17 public interface RejectedExecutionHandler { 18 19 /** 20 * Method that may be invoked by a {@link ThreadPoolExecutor} when 21 * <tt>execute</tt> cannot accept a task. This may occur when no 22 * more threads or queue slots are available because their bounds 23 * would be exceeded, or upon shutdown of the Executor. 24 * 25 * In the absence other alternatives, the method may throw an 26 * unchecked {@link RejectedExecutionException}, which will be 27 * propagated to the caller of <tt>execute</tt>. 28 * 29 * @param r the runnable task requested to be executed 30 * @param executor the executor attempting to execute this task 31 * @throws RejectedExecutionException if there is no remedy 32 */ 33 void rejectedExecution(Runnable r, ThreadPoolExecutor executor); 34 } 35