CompletionServiceV


CompletionService<V> java.util.concurrent

Java 5.0

This interface combines the features of an ExecutorService with the features of a BlockingQueue . A producer thread may submit Callable or Runnable tasks for asynchronous execution. As each submitted task completes, its result, in the form of a Future object, becomes available to be removed from the queue by a consumer thread that calls poll( ) or take( ) .

This generic type declares a type variable V , which represents the result type of all tasks on the queue.

 public interface  CompletionService<V>  {  // Public Instance Methods  Future<V>  poll  ( );        Future<V>  poll  (long  timeout  , TimeUnit  unit  ) throws InterruptedException;        Future<V>  submit  (Callable<V>  task  );        Future<V>  submit  (Runnable  task  , V  result  );        Future<V>  take  ( ) throws InterruptedException;   } 

Implementations

ExecutorCompletionService



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net