public class SubscriptionIntermediateFuture<E> extends TerminableIntermediateFuture<E> implements ISubscriptionIntermediateFuture<E>
IForwardCommandFuture.Type
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.Thread,java.util.List<E>> |
ownresults
The local results for a single thread.
|
protected boolean |
storeforfirst
Flag if results should be stored till first listener is added.
|
bcommands, terminate
icallers, indices, intermediate, notcommand, results
CALLER_QUEUED, CALLER_RESUMED, CALLER_SUSPENDED, callers, creation, DEBUG, exception, first, listener, listeners, NO_STACK_COMPACTION, NONE, notifications, result, resultavailable, STACK, undone, UNSET
DONE
Constructor and Description |
---|
SubscriptionIntermediateFuture()
Create a new future.
|
SubscriptionIntermediateFuture(java.lang.Exception exception)
Create a future that is already done (failed).
|
SubscriptionIntermediateFuture(ITerminationCommand terminate)
Create a new future.
|
SubscriptionIntermediateFuture(ITerminationCommand terminate,
boolean storeforfirst)
Create a new future.
|
Modifier and Type | Method and Description |
---|---|
void |
addQuietListener(IResultListener<java.util.Collection<E>> listener)
Add a listener which is only informed about new results,
i.e.
|
void |
addResultListener(IResultListener<java.util.Collection<E>> listener)
Add a result listener.
|
protected E |
doGetNextIntermediateResult(int index,
long timeout,
boolean realtime)
Perform the get without increasing the index.
|
java.util.Collection<E> |
getIntermediateResults()
Get the intermediate results that are available.
|
E |
getNextIntermediateResult(long timeout,
boolean realtime)
Iterate over the intermediate results in a blocking fashion.
|
boolean |
hasNextIntermediateResult(long timeout,
boolean realtime)
Check if there are more results for iteration for the given caller.
|
protected void |
storeResult(E result)
Store a result.
|
addBackwardCommand, getTerminationCommand, removeBackwardCommand, sendBackwardCommand, setTerminationCommand, terminate, terminate
addIntermediateResult, addIntermediateResultIfUndone, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, doAddIntermediateResult, doSetFinished, doSetResult, flatMapAsync, getNextIntermediateResult, getNextIntermediateResult, getNotificationCommand, hasNextIntermediateResult, mapAsync, mapAsync, notifyIntermediateResult, resume, resumeIntermediate, setFinished, setFinishedIfUndone
abortGet, acceptEither, addResultListener, addResultListener, applyToEither, delegate, doSetException, exceptionally, exceptionally, exceptionally, executeNotification, get, get, get, get, get, getEmptyFuture, getException, getFuture, hasResultListener, isDone, notifyListener, notifyListener, scheduleNotification, scheduleNotification, scheduleNotification, sendForwardCommand, setException, setExceptionIfUndone, setResult, setResultIfUndone, startScheduledNotifications, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, addIntermediateResultListener, flatMapAsync, getNextIntermediateResult, hasNextIntermediateResult, mapAsync, mapAsync
terminate, terminate
acceptEither, addResultListener, addResultListener, applyToEither, delegate, exceptionally, exceptionally, exceptionally, get, get, get, get, get, getException, isDone, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
sendBackwardCommand
protected java.util.Map<java.lang.Thread,java.util.List<E>> ownresults
protected boolean storeforfirst
public SubscriptionIntermediateFuture()
public SubscriptionIntermediateFuture(java.lang.Exception exception)
exception
- The exception.public SubscriptionIntermediateFuture(ITerminationCommand terminate)
terminate
- The code to be executed in case of termination.public SubscriptionIntermediateFuture(ITerminationCommand terminate, boolean storeforfirst)
terminate
- The code to be executed in case of termination.protected void storeResult(E result)
storeResult
in class IntermediateFuture<E>
result
- The result.public void addQuietListener(IResultListener<java.util.Collection<E>> listener)
addQuietListener
in interface ISubscriptionIntermediateFuture<E>
public void addResultListener(IResultListener<java.util.Collection<E>> listener)
addResultListener
in interface IFuture<java.util.Collection<E>>
addResultListener
in class IntermediateFuture<E>
listsner
- The listener.public java.util.Collection<E> getIntermediateResults()
getIntermediateResults
in interface IIntermediateFuture<E>
getIntermediateResults
in interface ISubscriptionIntermediateFuture<E>
getIntermediateResults
in class IntermediateFuture<E>
public E getNextIntermediateResult(long timeout, boolean realtime)
getNextIntermediateResult
in interface IIntermediateFuture<E>
getNextIntermediateResult
in class IntermediateFuture<E>
timeout
- The timeout in millis.realtime
- Flag, if wait should be realtime (in constrast to simulation time).NoSuchElementException,
- when there are no more intermediate results and the future is finished.public boolean hasNextIntermediateResult(long timeout, boolean realtime)
hasNextIntermediateResult
in interface IIntermediateFuture<E>
hasNextIntermediateResult
in class IntermediateFuture<E>
timeout
- The timeout in millis.realtime
- Flag, if wait should be realtime (in constrast to simulation time).protected E doGetNextIntermediateResult(int index, long timeout, boolean realtime)
doGetNextIntermediateResult
in class IntermediateFuture<E>