8 |
|
|
9 |
|
/** |
10 |
|
* A service that decouples the production of new asynchronous tasks |
11 |
< |
* and the comsumption of the reasults of completed tasks. |
11 |
> |
* versus the comsumption of the results of completed tasks. |
12 |
> |
* Producers <tt>submit</tt> tasks for execution. Consumers |
13 |
> |
* <tt>take</tt> completed tasks and process their results in whatever |
14 |
> |
* order they become available. A <tt>CompletionService</tt> can for |
15 |
> |
* example be used to manage asynchronous IO, in which tasks that |
16 |
> |
* perform reads are submitted in one part of a program or system, and |
17 |
> |
* then acted upon in a different part of the program when the reads |
18 |
> |
* complete, possibly in a different order than they were requested. |
19 |
> |
|
20 |
> |
* <p> |
21 |
> |
* |
22 |
> |
* Typically, a <tt>CompletionService</tt> relies on a separate {@link |
23 |
> |
* Executor} to actually execute the tasks, in which case the |
24 |
> |
* <tt>CompletionService</tt> only manages an internal completion |
25 |
> |
* queue. The {@link ExecutorCompletionService} class provides an |
26 |
> |
* implementation of this approach. |
27 |
> |
* |
28 |
|
*/ |
29 |
|
public interface CompletionService<V> { |
30 |
|
/** |