01: package org.objectweb.celtix.workqueue;
02:
03: import java.util.concurrent.Executor;
04:
05: public interface WorkQueue extends Executor {
06: /**
07: * Submits a work item for execution at some time in the future, waiting for up to a
08: * specified amount of time for the item to be accepted.
09: *
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: }
|