10 |
|
* An object that executes submitted tasks. This interface provides a |
11 |
|
* way of decoupling task submission from the mechanics of how each |
12 |
|
* task will be run, including details of thread use, scheduling, etc. |
13 |
< |
* |
14 |
< |
* <p>In the simplest case, an executor can run the submitted task immediately |
15 |
< |
* in the caller's thread: |
13 |
> |
* In the simplest case, an executor can run the submitted task |
14 |
> |
* immediately in the caller's thread: |
15 |
|
* |
16 |
|
* <pre> |
17 |
|
* class DirectExecutor implements Executor { |
31 |
|
* } |
32 |
|
* }</pre> |
33 |
|
* |
34 |
< |
* Most <tt>Executor</tt> implementations will impose some sort of limitation |
35 |
< |
* on how and when tasks are scheduled. The executor below serializes the |
36 |
< |
* submission of tasks to a second executor, illustrating a composite executor. |
34 |
> |
* Most <tt>Executor</tt> implementations will impose some sort of |
35 |
> |
* limitation on how and when tasks are scheduled. The executor below |
36 |
> |
* serializes the submission of tasks to a second executor, |
37 |
> |
* illustrating a composite executor. |
38 |
|
* |
39 |
|
* <pre> |
40 |
|
* class SerialExecutor implements Executor { |
68 |
|
* } |
69 |
|
* }</pre> |
70 |
|
* |
71 |
< |
* The <tt>Executor</tt> implementations provided in |
72 |
< |
* <tt>java.util.concurrent</tt> implement {@link ExecutorService}, |
73 |
< |
* which is a more extensive interface. For more advanced users, the |
74 |
< |
* {@link ThreadPoolExecutor} class provides a powerful, extensible |
75 |
< |
* thread pool implementation. The {@link Executors} class provides |
76 |
< |
* convenient factory methods for these executors. |
71 |
> |
* The <tt>Executor</tt> implementations provided in this package |
72 |
> |
* implement {@link ExecutorService}, which is a more extensive |
73 |
> |
* interface. The {@link ThreadPoolExecutor} class provides an |
74 |
> |
* extensible thread pool implementation. The {@link Executors} class |
75 |
> |
* provides convenient factory methods for these Executors. |
76 |
|
* |
77 |
|
* @since 1.5 |
79 |
– |
* @see Executors |
80 |
– |
* @see FutureTask |
81 |
– |
* |
82 |
– |
* @spec JSR-166 |
83 |
– |
* @revised $Date$ |
84 |
– |
* @editor $Author$ |
78 |
|
* @author Doug Lea |
79 |
|
*/ |
80 |
|
public interface Executor { |
85 |
|
* thread, at the discretion of the <tt>Executor</tt> implementation. |
86 |
|
* |
87 |
|
* @param command the runnable task |
88 |
< |
* @throws RejectedExecutionException if task cannot be submitted for |
89 |
< |
* execution |
88 |
> |
* @throws RejectedExecutionException if this task cannot be |
89 |
> |
* accepted for execution. |
90 |
|
*/ |
91 |
|
void execute(Runnable command); |
92 |
|
} |