public class IntermediateFuture<E> extends Future<Collection<E>> implements IIntermediateFuture<E>
IForwardCommandFuture.Type
DEBUG, EMPTY, NO_STACK_COMPACTION, STACK
DONE
Constructor and Description |
---|
IntermediateFuture()
Create a future that is already done.
|
IntermediateFuture(Collection<E> results)
Create a future that is already done.
|
IntermediateFuture(Exception exception)
Create a future that is already done (failed).
|
Modifier and Type | Method and Description |
---|---|
void |
addIntermediateResult(E result)
Add an intermediate result.
|
boolean |
addIntermediateResultIfUndone(E result)
Set the result.
|
void |
addResultListener(IResultListener<Collection<E>> listener)
Add a result listener.
|
Collection<E> |
getIntermediateResults()
Get the intermediate results that are available.
|
E |
getNextIntermediateResult()
Iterate over the intermediate results in a blocking fashion.
|
E |
getNextIntermediateResult(ISuspendable sus)
Iterate over the intermediate results in a blocking fashion.
|
boolean |
hasNextIntermediateResult()
Check if there are more results for iteration for the given caller.
|
void |
setFinished()
Declare that the future is finished.
|
boolean |
setFinishedIfUndone()
Declare that the future is finished.
|
void |
setResult(Collection<E> result)
Set the result.
|
boolean |
setResultIfUndone(Collection<E> result)
Set the result.
|
abortGet, addForwardCommand, get, get, get, get, getEmptyFuture, getException, isDone, removeForwardCommand, sendForwardCommand, setException, setExceptionIfUndone
public IntermediateFuture()
result
- The result, if any.public IntermediateFuture(Collection<E> results)
result
- The result, if any.public IntermediateFuture(Exception exception)
exception
- The exception.public Collection<E> getIntermediateResults()
getIntermediateResults
in interface IIntermediateFuture<E>
public void addIntermediateResult(E result)
public boolean addIntermediateResultIfUndone(E result)
result
- The result.public void setResult(Collection<E> result)
setResult
in class Future<Collection<E>>
result
- The result.public boolean setResultIfUndone(Collection<E> result)
setResultIfUndone
in class Future<Collection<E>>
result
- The result.public void setFinished()
public boolean setFinishedIfUndone()
public void addResultListener(IResultListener<Collection<E>> listener)
addResultListener
in interface IFuture<Collection<E>>
addResultListener
in class Future<Collection<E>>
listsner
- The listener.public boolean hasNextIntermediateResult()
hasNextIntermediateResult
in interface IIntermediateFuture<E>
public E getNextIntermediateResult()
getNextIntermediateResult
in interface IIntermediateFuture<E>
NoSuchElementException,
- when there are no more intermediate results and the future is finished.public E getNextIntermediateResult(ISuspendable sus)
NoSuchElementException,
- when there are no more intermediate results and the future is finished.Copyright © 2013. All Rights Reserved.