5 |
|
*/ |
6 |
|
|
7 |
|
package java.util.concurrent; |
8 |
+ |
import java.util.concurrent.*; // for javadoc (till 6280605 is fixed) |
9 |
|
|
10 |
|
/** |
11 |
|
* A service that decouples the production of new asynchronous tasks |
18 |
|
* in a different part of the program when the reads complete, |
19 |
|
* possibly in a different order than they were requested. |
20 |
|
* |
21 |
< |
* <p> |
22 |
< |
* Typically, a <tt>CompletionService</tt> relies on a separate {@link |
22 |
< |
* Executor} to actually execute the tasks, in which case the |
21 |
> |
* <p>Typically, a <tt>CompletionService</tt> relies on a separate |
22 |
> |
* {@link Executor} to actually execute the tasks, in which case the |
23 |
|
* <tt>CompletionService</tt> only manages an internal completion |
24 |
|
* queue. The {@link ExecutorCompletionService} class provides an |
25 |
|
* implementation of this approach. |
26 |
|
* |
27 |
< |
* <p> Memory consistency effects: State changes to the value returned from |
28 |
< |
* a <tt>Callable</tt> <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a> |
29 |
< |
* actions following a successful return from the corresponding <tt>take()</tt>. |
27 |
> |
* <p>Memory consistency effects: Actions in a thread prior to |
28 |
> |
* submitting a task to a {@code CompletionService} |
29 |
> |
* <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a> |
30 |
> |
* actions taken by that task, which in turn <i>happen-before</i> |
31 |
> |
* actions following a successful return from the corresponding {@code take()}. |
32 |
|
* |
33 |
|
*/ |
34 |
|
public interface CompletionService<V> { |
45 |
|
*/ |
46 |
|
Future<V> submit(Callable<V> task); |
47 |
|
|
46 |
– |
|
48 |
|
/** |
49 |
|
* Submits a Runnable task for execution and returns a Future |
50 |
|
* representing that task. Upon completion, this task may be |