1 package org.objectweb.celtix.workqueue; 2 3 import java.util.concurrent.Executor; 4 5 public interface WorkQueue extends Executor { 6 /** 7 * Submits a work item for execution at some time in the future, waiting for up to a 8 * specified amount of time for the item to be accepted. 9 * 10 * @param work the workitem to submit for execution. 11 * @param timeout the maximum amount of time (in milliseconds) to wait for it to be accepted. 12 * 13 * @throws <code>RejectedExecutionException</code> if this work item cannot be accepted for execution. 14 * @throws <code>NullPointerException</code> if work item is null. 15 */ 16 void execute(Runnable work, long timeout); 17 18 /** 19 * Schedules a work item for execution at some time in the future. 20 * 21 * @param work the task to submit for execution. 22 * @param delay the delay before the task is executed 23 * 24 * @throws <code>RejectedExecutionException</code> if this task cannot be accepted for execution. 25 * @throws <code>NullPointerException</code> if task is null. 26 */ 27 void schedule(Runnable work, long delay); 28 } 29