9 |
|
|
10 |
|
/** |
11 |
|
* Provides default implementations of {@link ExecutorService} |
12 |
< |
* execution methods. This class implements the <tt>submit</tt>, |
13 |
< |
* <tt>invokeAny</tt> and <tt>invokeAll</tt> methods using a |
14 |
< |
* {@link RunnableFuture} returned by <tt>newTaskFor</tt>, which defaults |
12 |
> |
* execution methods. This class implements the {@code submit}, |
13 |
> |
* {@code invokeAny} and {@code invokeAll} methods using a |
14 |
> |
* {@link RunnableFuture} returned by {@code newTaskFor}, which defaults |
15 |
|
* to the {@link FutureTask} class provided in this package. For example, |
16 |
< |
* the implementation of <tt>submit(Runnable)</tt> creates an |
17 |
< |
* associated <tt>RunnableFuture</tt> that is executed and |
18 |
< |
* returned. Subclasses may override the <tt>newTaskFor</tt> methods |
19 |
< |
* to return <tt>RunnableFuture</tt> implementations other than |
20 |
< |
* <tt>FutureTask</tt>. |
16 |
> |
* the implementation of {@code submit(Runnable)} creates an |
17 |
> |
* associated {@code RunnableFuture} that is executed and |
18 |
> |
* returned. Subclasses may override the {@code newTaskFor} methods |
19 |
> |
* to return {@code RunnableFuture} implementations other than |
20 |
> |
* {@code FutureTask}. |
21 |
|
* |
22 |
|
* <p><b>Extension example</b>. Here is a sketch of a class |
23 |
|
* that customizes {@link ThreadPoolExecutor} to use |
24 |
< |
* a <tt>CustomTask</tt> class instead of the default <tt>FutureTask</tt>: |
24 |
> |
* a {@code CustomTask} class instead of the default {@code FutureTask}: |
25 |
|
* <pre> {@code |
26 |
|
* public class CustomThreadPoolExecutor extends ThreadPoolExecutor { |
27 |
|
* |
42 |
|
public abstract class AbstractExecutorService implements ExecutorService { |
43 |
|
|
44 |
|
/** |
45 |
< |
* Returns a <tt>RunnableFuture</tt> for the given runnable and default |
45 |
> |
* Returns a {@code RunnableFuture} for the given runnable and default |
46 |
|
* value. |
47 |
|
* |
48 |
|
* @param runnable the runnable task being wrapped |
49 |
|
* @param value the default value for the returned future |
50 |
< |
* @return a <tt>RunnableFuture</tt> which when run will run the |
51 |
< |
* underlying runnable and which, as a <tt>Future</tt>, will yield |
50 |
> |
* @return a {@code RunnableFuture} which when run will run the |
51 |
> |
* underlying runnable and which, as a {@code Future}, will yield |
52 |
|
* the given value as its result and provide for cancellation of |
53 |
|
* the underlying task. |
54 |
|
* @since 1.6 |
58 |
|
} |
59 |
|
|
60 |
|
/** |
61 |
< |
* Returns a <tt>RunnableFuture</tt> for the given callable task. |
61 |
> |
* Returns a {@code RunnableFuture} for the given callable task. |
62 |
|
* |
63 |
|
* @param callable the callable task being wrapped |
64 |
< |
* @return a <tt>RunnableFuture</tt> which when run will call the |
65 |
< |
* underlying callable and which, as a <tt>Future</tt>, will yield |
64 |
> |
* @return a {@code RunnableFuture} which when run will call the |
65 |
> |
* underlying callable and which, as a {@code Future}, will yield |
66 |
|
* the callable's result as its result and provide for |
67 |
|
* cancellation of the underlying task. |
68 |
|
* @since 1.6 |