V
- The type of object returned by the taskpublic interface IRepeatingFuture<V> extends Future<V>
A computation task has been scheduled to repeat a fixed number of times. This future allows the
result of each repetition to be retrieved and the progress thought repetitions is be monitored.
The Future.get()
methods inherited from Future
refer to the most recent execution.
Modifier and Type | Method and Description |
---|---|
int |
getCompletedExecutions()
Returns the number of times the task has run this allows progress through the repetitions to
be monitored.
|
int |
getExpectedExecutions()
Get the number of executions that should happen.
|
V |
getResult(int i)
Waits if necessary for the ith computation to complete, and then retrieves its result.
|
V |
getResult(int i,
long timeout,
TimeUnit unit)
Waits if necessary for the ith computation to complete, and then retrieves its result.
|
V getResult(int i) throws InterruptedException, ExecutionException, CancellationException, IndexOutOfBoundsException
i
- The execution of the task to get the result forInterruptedException
- Thrown if the thread was interrupted while the waitingExecutionException
- Thrown if the execution of the task resulted in an exceptionCancellationException
- Thrown if the task was cancelled before reaching the ith executionIndexOutOfBoundsException
- Thrown if the ith value is greater than the number of executions or it is less
than 0.V getResult(int i, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, CancellationException, TimeoutException, IndexOutOfBoundsException
i
- The execution of the task to get the result fortimeout
- The maximum time to waitunit
- The time unit of the timeout argumentInterruptedException
- Thrown if the thread was interrupted while the waitingExecutionException
- Thrown if the execution of the task resulted in an exceptionCancellationException
- Thrown if the task was cancelled before reaching the ith executionTimeoutException
- Thrown if the ith execution does not happen within the timeout periodIndexOutOfBoundsException
- Thrown if the ith value is greater than the number of executions or it is less
than 0.int getExpectedExecutions()
int getCompletedExecutions()
Copyright © 2016. All Rights Reserved.