14 |
|
|
15 |
|
<h2>Executors</h2> |
16 |
|
|
17 |
< |
{@link java.util.concurrent.Executor} is a simple standardized |
18 |
< |
interface for defining custom thread-like subsystems, including thread |
19 |
< |
pools, asynchronous IO, and lightweight task frameworks. Depending on |
20 |
< |
which concrete Executor class is being used, tasks may execute in a |
21 |
< |
newly created thread, an existing task-execution thread, or the thread |
22 |
< |
calling <tt>execute()</tt>, and may execute sequentially or |
23 |
< |
concurrently. |
24 |
< |
|
25 |
< |
<p> {@link java.util.concurrent.ExecutorService} provides a more |
26 |
< |
complete framework for executing Runnables. An ExecutorService |
27 |
< |
manages queueing and scheduling of tasks, and allows controlled |
28 |
< |
shutdown. The two primary implementations of ExecutorService are |
29 |
< |
{@link java.util.concurrent.ThreadPoolExecutor}, a tunable and |
30 |
< |
flexible thread pool and {@link |
31 |
< |
java.util.concurrent.ScheduledExecutor}, which adds support for |
32 |
< |
delayed and periodic task execution. The {@link |
17 |
> |
<b>Interfaces.</b> {@link java.util.concurrent.Executor} is a simple |
18 |
> |
standardized interface for defining custom thread-like subsystems, |
19 |
> |
including thread pools, asynchronous IO, and lightweight task |
20 |
> |
frameworks. Depending on which concrete Executor class is being used, |
21 |
> |
tasks may execute in a newly created thread, an existing |
22 |
> |
task-execution thread, or the thread calling <tt>execute()</tt>, and |
23 |
> |
may execute sequentially or concurrently. {@link |
24 |
> |
java.util.concurrent.ExecutorService} provides a more complete |
25 |
> |
asynchronous task execution framework. An ExecutorService manages |
26 |
> |
queueing and scheduling of tasks, and allows controlled shutdown. The |
27 |
> |
{@link java.util.concurrent.ScheduledExecutorService} subinterface |
28 |
> |
adds support for delayed and periodic task execution. |
29 |
> |
ExecutorServices provide methods arranging asynchronous execution of |
30 |
> |
any function expressed as {@link java.util.concurrent.Callable}, the |
31 |
> |
result-bearing analog of {@link java.lang.Runnable}. A {@link |
32 |
> |
java.util.concurrent.Future} returns the results of a function, allows |
33 |
> |
determination if execution has completed, and provides a means to |
34 |
> |
cancel execution. |
35 |
> |
|
36 |
> |
<p> |
37 |
> |
|
38 |
> |
<b>Implementations.</b> The two primary Executor implementations are |
39 |
> |
tunable, flexible thread pool classes {@link |
40 |
> |
java.util.concurrent.ThreadPoolExecutor} and {@link |
41 |
> |
java.util.concurrent.ScheduledThreadPoolExecutor}. The {@link |
42 |
|
java.util.concurrent.Executors} class provides factory methods for the |
43 |
|
most common kinds and configurations of Executors, as well as a few |
44 |
< |
utility methods for using them. |
45 |
< |
|
46 |
< |
<p> Executors may be used with threads that compute functions |
47 |
< |
returning results. A {@link java.util.concurrent.Future} returns the |
48 |
< |
results of a {@link java.util.concurrent.Callable}, the result-bearing |
40 |
< |
analog of {@link java.lang.Runnable}. Instances of concrete class |
41 |
< |
{@link java.util.concurrent.FutureTask} may be submitted to Executors |
42 |
< |
to asynchronously start a potentially long-running computation, query |
43 |
< |
to determine if its execution has completed, or cancel it. The {@link |
44 |
< |
java.util.concurrent.CancellableTask} class provides similar control |
45 |
< |
for actions that do not bear results. |
44 |
> |
utility methods for using them. Other utilities based on Executors |
45 |
> |
include the concrete class {@link java.util.concurrent.FutureTask} |
46 |
> |
providing a common extensible implementation of Futures, and {@link |
47 |
> |
java.util.concurrent.ExecutorCompletionService}, that assists in |
48 |
> |
coordinating the processing of groups of asynchronous tasks. |
49 |
|
|
50 |
|
<h2>Queues</h2> |
51 |
|
|