edu.emory.mathcs.backport.java.util.concurrent
public abstract class AbstractExecutorService extends Object implements ExecutorService
Extension example. Here is a sketch of a class that customizes ThreadPoolExecutor to use a CustomTask class instead of the default FutureTask:
public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
static class CustomTask<V> implements RunnableFuture<V> {...}
protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
return new CustomTask<V>(c);
}
protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
return new CustomTask<V>(r, v);
}
// ... add constructors, etc.
}
Since: 1.5
| Method Summary | |
|---|---|
| List | invokeAll(Collection tasks) |
| List | invokeAll(Collection tasks, long timeout, TimeUnit unit) |
| Object | invokeAny(Collection tasks) |
| Object | invokeAny(Collection tasks, long timeout, TimeUnit unit) |
| protected RunnableFuture | newTaskFor(Runnable runnable, Object value)
Returns a RunnableFuture for the given runnable and default
value.
|
| protected RunnableFuture | newTaskFor(Callable callable)
Returns a RunnableFuture for the given callable task.
|
| Future | submit(Runnable task) |
| Future | submit(Runnable task, Object result) |
| Future | submit(Callable task) |
Parameters: runnable the runnable task being wrapped value the default value for the returned future
Returns: a RunnableFuture which when run will run the underlying runnable and which, as a Future, will yield the given value as its result and provide for cancellation of the underlying task.
Since: 1.6
Parameters: callable the callable task being wrapped
Returns: a RunnableFuture which when run will call the underlying callable and which, as a Future, will yield the callable's result as its result and provide for cancellation of the underlying task.
Since: 1.6
Throws: RejectedExecutionException {@inheritDoc } NullPointerException {@inheritDoc }
Throws: RejectedExecutionException {@inheritDoc } NullPointerException {@inheritDoc }
Throws: RejectedExecutionException {@inheritDoc } NullPointerException {@inheritDoc }