Q
- reQuest typeR
- Response typepublic abstract class QueuingExecutorCompletionService<Q,R>
extends java.util.concurrent.ExecutorCompletionService<R>
Constructor and Description |
---|
QueuingExecutorCompletionService(java.util.concurrent.ExecutorService executorService,
java.util.Queue<Q> requests,
int concurrentRequests) |
Modifier and Type | Method and Description |
---|---|
abstract R |
executeRequest(Q request)
Subclasses should override this method with the desired execution method, which will
ultimately be wrapped in a Callable for submission to the ExecutorCompletionService.
|
boolean |
hasRequestsOutstanding() |
java.util.concurrent.Future<R> |
poll() |
java.util.concurrent.Future<R> |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.Future<R> |
take() |
public QueuingExecutorCompletionService(java.util.concurrent.ExecutorService executorService, java.util.Queue<Q> requests, int concurrentRequests)
executorService
- the executor service to execute the requestsrequests
- the Queue of requests to executeconcurrentRequests
- the number of concurrent requestspublic boolean hasRequestsOutstanding()
public java.util.concurrent.Future<R> poll()
public java.util.concurrent.Future<R> poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
public java.util.concurrent.Future<R> take() throws java.lang.InterruptedException