Package jadex.future
Class TerminableIntermediateDelegationFuture<E>
java.lang.Object
jadex.future.Future<Collection<E>>
jadex.future.IntermediateFuture<E>
jadex.future.TerminableIntermediateDelegationFuture<E>
- All Implemented Interfaces:
IBackwardCommandFuture
,IForwardCommandFuture
,IFuture<Collection<E>>
,IIntermediateFuture<E>
,ITerminableFuture<Collection<E>>
,ITerminableIntermediateFuture<E>
,Supplier<Collection<E>>
- Direct Known Subclasses:
PullIntermediateDelegationFuture
,SubscriptionIntermediateDelegationFuture
public class TerminableIntermediateDelegationFuture<E>
extends IntermediateFuture<E>
implements ITerminableIntermediateFuture<E>
A terminable intermediate delegation future can be used when a termination intermediate future
should be delegated. This kind of future needs to be connected to the
termination source (another delegation or a real future). Termination
calls are forwarded to the termination source. The future remembers
when terminate() was called in unconnected state and forwards the request
as soon as the connection is established.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jadex.future.IForwardCommandFuture
IForwardCommandFuture.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TerminableDelegationFutureHandler
<Collection<E>> The forward/backward handling helper.Fields inherited from class jadex.future.IntermediateFuture
icallers, indices, intermediate, maxresultcnt, notcommand, results
Fields inherited from class jadex.future.Future
CALLER_QUEUED, CALLER_RESUMED, CALLER_SUSPENDED, callers, creation, DEBUG, exception, first, listeners, NO_STACK_COMPACTION, NONE, NOTIFICATIONS, notificount, notified, result, resultavailable, undone, UNSET
Fields inherited from interface jadex.future.IIntermediateFuture
DONE
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new future.Create a new future. -
Method Summary
Modifier and TypeMethodDescriptionvoid
delegateFrom
(IFuture<Collection<E>> source) Delegate the result and exception from another future.void
sendBackwardCommand
(Object info) Send a backward command in direction of the source.void
Set the source.void
Terminate the future.void
Terminate the future and supply a custom reason.Methods inherited from class jadex.future.IntermediateFuture
addIntermediateResult, addIntermediateResultIfUndone, addResultListener, asStream, asStream, catchEx, delegateEx, doAddIntermediateResult, doGetNextIntermediateResult, done, doSetException, doSetFinished, doSetResult, finished, getIntermediateResults, getNextIntermediateResult, getNextIntermediateResult, getNextIntermediateResult, getNotificationCommand, getResultCount, hasNextIntermediateResult, hasNextIntermediateResult, max, next, notifyIntermediateResult, resume, resumeIntermediate, scheduleMaxNotification, setFinished, setFinishedIfUndone, setMaxResultCount, storeResult, then
Methods inherited from class jadex.future.Future
abortGet, catchEx, catchEx, delegate, delegateTo, doAddResultListener, doStartScheduledNotifications, executeNotification, get, get, get, get, get, getEmptyFuture, getException, getFuture, hasResultListener, isDone, isNotified, printOnEx, scheduleNotification, scheduleNotification, sendForwardCommand, setException, setExceptionIfUndone, setResult, setResultIfUndone, startScheduledNotifications, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose, throwException
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jadex.future.IFuture
addResultListener, catchEx, catchEx, catchEx, delegate, delegateTo, get, get, get, get, get, getException, isDone, printOnEx, then, thenApply, thenApply, thenCompose, thenCompose
Methods inherited from interface jadex.future.IIntermediateFuture
asStream, asStream, done, finished, getIntermediateResults, getNextIntermediateResult, getNextIntermediateResult, hasNextIntermediateResult, hasNextIntermediateResult, max, next
-
Field Details
-
handler
The forward/backward handling helper.
-
-
Constructor Details
-
TerminableIntermediateDelegationFuture
public TerminableIntermediateDelegationFuture()Create a new future. -
TerminableIntermediateDelegationFuture
Create a new future.
-
-
Method Details
-
setTerminationSource
Set the source. -
terminate
public void terminate()Terminate the future. The exception will be set to FutureTerminatedException.- Specified by:
terminate
in interfaceITerminableFuture<E>
-
terminate
Terminate the future and supply a custom reason.- Specified by:
terminate
in interfaceITerminableFuture<E>
-
delegateFrom
Delegate the result and exception from another future.- Overrides:
delegateFrom
in classIntermediateFuture<E>
- Parameters:
source
- The source future.
-
sendBackwardCommand
Send a backward command in direction of the source.- Specified by:
sendBackwardCommand
in interfaceIBackwardCommandFuture
- Parameters:
info
- The command info.
-