19 |
|
* @spec JSR-166 |
20 |
|
* @revised $Date$ |
21 |
|
* @editor $Author$ |
22 |
+ |
* @author Doug Lea |
23 |
|
*/ |
24 |
|
public class Executors { |
25 |
|
|
61 |
|
* ThreadFactory to create new threads when needed. |
62 |
|
* |
63 |
|
* @param nThreads the number of threads in the pool |
64 |
< |
* @param threadfactory the factory to use when creating new threads |
64 |
> |
* @param threadFactory the factory to use when creating new threads |
65 |
|
* @return the newly created thread pool |
66 |
|
*/ |
67 |
|
public static ExecutorService newFixedThreadPool(int nThreads, ThreadFactory threadFactory) { |
94 |
|
* Creates an Executor that uses a single worker thread operating |
95 |
|
* off an unbounded queue, and uses the provided ThreadFactory to |
96 |
|
* create new threads when needed. |
97 |
< |
* @param threadfactory the factory to use when creating new |
97 |
> |
* @param threadFactory the factory to use when creating new |
98 |
|
* threads |
99 |
|
* |
100 |
|
* @return the newly-created single-threaded Executor |
133 |
|
* will reuse previously constructed threads when they are |
134 |
|
* available, and uses the provided |
135 |
|
* ThreadFactory to create new threads when needed. |
136 |
< |
* @param threadfactory the factory to use when creating new threads |
136 |
> |
* @param threadFactory the factory to use when creating new threads |
137 |
|
* @return the newly created thread pool |
138 |
|
*/ |
139 |
|
public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory) { |
203 |
|
* @return a Future representing pending completion of the task |
204 |
|
* @throws RejectedExecutionException if task cannot be scheduled |
205 |
|
* for execution |
206 |
+ |
* @throws InterruptedException if interrupted while waiting for |
207 |
+ |
* completion |
208 |
|
*/ |
209 |
|
public static <T> T invoke(Executor executor, Callable<T> task) |
210 |
|
throws ExecutionException, InterruptedException { |