Name

AbstractExecutorService

Synopsis

This abstract class implements the submit( ), invokeAll( ), and invokeAny( ) methods of the ExecutorService interface. It does not implement the ExecutorService shutdown methods or the crucial execute( ) method for asynchronous execution of Runnable tasks.

The methods implemented by AbstractExecutorService wrap the submitted Callable or Runnable task in a FutureTask object. FutureTask implements Runnable and Future, which are first passed to the abstract execute( ) method to be run asynchronously and then returned to the caller.

See ThreadPoolExecutor for a concrete implementation, and see Executors for convenient ExecutorService factory methods.

java.util.concurrent.AbstractExecutorService

Figure 16-70. java.util.concurrent.AbstractExecutorService

public abstract class AbstractExecutorService implements ExecutorService {
// Public Constructors
     public AbstractExecutorService( );  
// Methods Implementing ExecutorService
     public <T> java.util.List<Future<T>> invokeAll(java.util.Collection<Callable<T>> tasks) 
        throws InterruptedException;  
     public <T> java.util.List<Future<T>> invokeAll(java.util.Collection<Callable<T>> tasks, 
        long timeout, TimeUnit unit) throws InterruptedException;  
     public <T> T invokeAny(java.util.Collection<Callable<T>> tasks) 
        throws InterruptedException, ExecutionException;  
     public <T> T invokeAny(java.util.Collection<Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.