Package jadex.commons.future
Class TerminableDelegationFutureHandler<E>
- java.lang.Object
-
- jadex.commons.future.TerminableDelegationFutureHandler<E>
-
public class TerminableDelegationFutureHandler<E> extends java.lang.ObjectHandler for common code of (non) intermediate terminable delegation future. Workaround for missing multiple inheritance.
-
-
Field Summary
Fields Modifier and Type Field Description protected intpullcntThe number of intermediate pulls to be performed, when the source is connected.protected java.lang.ExceptionreasonException used for termination.protected ITerminableFuture<E>srcThe termination source.protected java.util.List<java.lang.Object>storedcmdsThe list of stored backward commands, to be sent when src is connected.protected booleanterminateFlag if source has to be terminated.protected booleanterminatedFlag if source has been terminated.
-
Constructor Summary
Constructors Constructor Description TerminableDelegationFutureHandler()Create a new future.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpullIntermediateResult()Pull an intermediate result.voidsendBackwardCommand(java.lang.Object info)Send a backward command in direction of the source.voidsetTerminationSource(ITerminableFuture<E> src)Set the termination source.voidterminate()Terminate the future.voidterminate(java.lang.Exception reason)Terminate the future and supply a custom reason.
-
-
-
Field Detail
-
src
protected ITerminableFuture<E> src
The termination source.
-
terminate
protected boolean terminate
Flag if source has to be terminated.
-
terminated
protected boolean terminated
Flag if source has been terminated.
-
reason
protected java.lang.Exception reason
Exception used for termination.
-
storedcmds
protected java.util.List<java.lang.Object> storedcmds
The list of stored backward commands, to be sent when src is connected.
-
pullcnt
protected int pullcnt
The number of intermediate pulls to be performed, when the source is connected.
-
-
Method Detail
-
setTerminationSource
public void setTerminationSource(ITerminableFuture<E> src)
Set the termination source.
-
terminate
public void terminate()
Terminate the future. The exception will be set to FutureTerminatedException.
-
terminate
public void terminate(java.lang.Exception reason)
Terminate the future and supply a custom reason.
-
pullIntermediateResult
public void pullIntermediateResult()
Pull an intermediate result.
-
sendBackwardCommand
public void sendBackwardCommand(java.lang.Object info)
Send a backward command in direction of the source.- Parameters:
info- The command info.
-
-