@InterfaceAudience.Private public class ResultBoundedCompletionService<V> extends Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
ResultBoundedCompletionService.QueueingFuture<T> |
Modifier and Type | Field and Description |
---|---|
private boolean |
cancelled |
private ArrayList<ResultBoundedCompletionService.QueueingFuture> |
completedTasks |
private Executor |
executor |
private static org.slf4j.Logger |
LOG |
private RpcRetryingCallerFactory |
retryingCallerFactory |
private ResultBoundedCompletionService.QueueingFuture<V>[] |
tasks |
Constructor and Description |
---|
ResultBoundedCompletionService(RpcRetryingCallerFactory retryingCallerFactory,
Executor executor,
int maxTasks) |
Modifier and Type | Method and Description |
---|---|
void |
cancelAll() |
ResultBoundedCompletionService.QueueingFuture<V> |
poll(long timeout,
TimeUnit unit)
Poll for the first completed task whether it is a success or execution exception.
|
ResultBoundedCompletionService.QueueingFuture<V> |
pollForFirstSuccessfullyCompletedTask(long timeout,
TimeUnit unit,
int startIndex,
int endIndex)
Poll for the first successfully completed task whose completed order is in startIndex,
endIndex(exclusive) range
|
private ResultBoundedCompletionService.QueueingFuture<V> |
pollForSpecificCompletedTask(long timeout,
TimeUnit unit,
int index)
Poll for the Nth completed task (index starts from 0 (the 1st), 1 (the second)...)
|
void |
submit(RetryingCallable<V> task,
int callTimeout,
int id) |
ResultBoundedCompletionService.QueueingFuture<V> |
take() |
private static final org.slf4j.Logger LOG
private final RpcRetryingCallerFactory retryingCallerFactory
private final ResultBoundedCompletionService.QueueingFuture<V>[] tasks
private final ArrayList<ResultBoundedCompletionService.QueueingFuture> completedTasks
private volatile boolean cancelled
public ResultBoundedCompletionService(RpcRetryingCallerFactory retryingCallerFactory, Executor executor, int maxTasks)
public void submit(RetryingCallable<V> task, int callTimeout, int id)
public ResultBoundedCompletionService.QueueingFuture<V> take() throws InterruptedException
InterruptedException
public ResultBoundedCompletionService.QueueingFuture<V> poll(long timeout, TimeUnit unit) throws InterruptedException
timeout
- - time to wait before it times outunit
- - time unit for timeoutInterruptedException
public ResultBoundedCompletionService.QueueingFuture<V> pollForFirstSuccessfullyCompletedTask(long timeout, TimeUnit unit, int startIndex, int endIndex) throws InterruptedException, CancellationException, ExecutionException
timeout
- - time to wait before it times outunit
- - time unit for timeoutstartIndex
- - start index, starting from 0, inclusiveendIndex
- - end index, exclusiveInterruptedException
CancellationException
ExecutionException
private ResultBoundedCompletionService.QueueingFuture<V> pollForSpecificCompletedTask(long timeout, TimeUnit unit, int index) throws InterruptedException
timeout
- - time to wait before it times outunit
- - time unit for timeoutindex
- - the index(th) completed task, index starting from 0InterruptedException
public void cancelAll()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.