Package jadex.future
Class IntermediateExceptionDelegationResultListener<E,T>
java.lang.Object
jadex.future.IntermediateExceptionDelegationResultListener<E,T>
- All Implemented Interfaces:
IFutureCommandResultListener<Collection<E>>,IIntermediateResultListener<E>,IResultListener<Collection<E>>,IUndoneIntermediateResultListener<E>,IUndoneResultListener<Collection<E>>
public class IntermediateExceptionDelegationResultListener<E,T>
extends Object
implements IIntermediateResultListener<E>, IFutureCommandResultListener<Collection<E>>, IUndoneIntermediateResultListener<E>
Exception delegation listener for intermediate futures.
-
Field Summary
FieldsModifier and TypeFieldDescriptionCustom functional result count listener.protected RunnableCustom functional finished listenerThe future to which calls are delegated.Custom functional result listenerprotected booleanThe undone flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommandAvailable(Object command) Called when a command is available.voidcustomResultAvailable(Collection<E> result) Called when the result is available.voidexceptionOccurred(Exception exception) Called when an exception occurred.voidexceptionOccurredIfUndone(Exception exception) Called when an exception occurred.voidfinished()Declare that the future is finished.voidDeclare that the future is finished.voidintermediateResultAvailable(E result) Called when an intermediate result is available.voidintermediateResultAvailableIfUndone(E result) Called when an intermediate result is available.booleanisUndone()Get the undone.voidmaxResultCountAvailable(int max) Declare that the future result count is available.voidresultAvailable(Collection<E> result) Called when the result is available.voidresultAvailableIfUndone(Collection<E> result) Called when the result is available.
-
Field Details
-
future
The future to which calls are delegated. -
undone
protected boolean undoneThe undone flag. -
irlistener
Custom functional result listener -
flistener
Custom functional finished listener -
clistener
Custom functional result count listener.
-
-
Constructor Details
-
IntermediateExceptionDelegationResultListener
public IntermediateExceptionDelegationResultListener(Future<T> future, Consumer<E> irlistener, Runnable flistener, Consumer<Integer> clistener) Create a new listener.- Parameters:
future- The delegation target.irlistener- Functional intermediate result Listener. Can benull.flistener- Functional finished listener. Can benull.
-
IntermediateExceptionDelegationResultListener
Create a new listener.
-
-
Method Details
-
resultAvailable
Called when the result is available. This method is only called for non-intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method has not been called.- Specified by:
resultAvailablein interfaceIResultListener<E>- Parameters:
result- The final result.
-
intermediateResultAvailable
Called when an intermediate result is available.- Specified by:
intermediateResultAvailablein interfaceIIntermediateResultListener<E>- Parameters:
result- The result.
-
finished
public void finished()Declare that the future is finished. This method is only called for intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method was called for all intermediate results before.- Specified by:
finishedin interfaceIIntermediateResultListener<E>
-
customResultAvailable
Called when the result is available.- Parameters:
result- The result.
-
exceptionOccurred
Called when an exception occurred.- Specified by:
exceptionOccurredin interfaceIResultListener<E>- Parameters:
exception- The exception.
-
maxResultCountAvailable
public void maxResultCountAvailable(int max) Description copied from interface:IIntermediateResultListenerDeclare that the future result count is available. This method is only called for intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method will be called as often as the result count indicates except an exception occurs.- Specified by:
maxResultCountAvailablein interfaceIIntermediateResultListener<E>
-
resultAvailableIfUndone
Called when the result is available.- Specified by:
resultAvailableIfUndonein interfaceIUndoneResultListener<E>- Parameters:
result- The result.
-
exceptionOccurredIfUndone
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndonein interfaceIUndoneResultListener<E>- Parameters:
exception- The exception.
-
intermediateResultAvailableIfUndone
Called when an intermediate result is available.- Specified by:
intermediateResultAvailableIfUndonein interfaceIUndoneIntermediateResultListener<E>- Parameters:
result- The result.
-
finishedIfUndone
public void finishedIfUndone()Declare that the future is finished. This method is only called for intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method was called for all intermediate results before.- Specified by:
finishedIfUndonein interfaceIUndoneIntermediateResultListener<E>
-
commandAvailable
Called when a command is available.- Specified by:
commandAvailablein interfaceIFutureCommandResultListener<E>
-
isUndone
public boolean isUndone()Get the undone.- Returns:
- The undone.
-