Package jadex.commons.future
Class IntermediateExceptionDelegationResultListener<E,T>
- java.lang.Object
-
- jadex.commons.future.IntermediateExceptionDelegationResultListener<E,T>
-
- All Implemented Interfaces:
IFunctionalExceptionListener
,IFunctionalIntermediateFinishedListener<E>
,IFunctionalIntermediateResultListener<E>
,IFunctionalResultListener<java.util.Collection<E>>
,IFutureCommandResultListener<java.util.Collection<E>>
,IIntermediateResultListener<E>
,IResultListener<java.util.Collection<E>>
,IUndoneIntermediateResultListener<E>
,IUndoneResultListener<java.util.Collection<E>>
public class IntermediateExceptionDelegationResultListener<E,T> extends java.lang.Object implements IIntermediateResultListener<E>, IFutureCommandResultListener<java.util.Collection<E>>, IUndoneIntermediateResultListener<E>
Exception delegation listener for intermediate futures.
-
-
Field Summary
Fields Modifier and Type Field Description protected IFunctionalResultListener<java.lang.Void>
finishedListener
Custom functional finished listenerprotected Future<T>
future
The future to which calls are delegated.protected IFunctionalResultListener<E>
intermediateResultListener
Custom functional result listenerprotected boolean
undone
The undone flag.
-
Constructor Summary
Constructors Constructor Description IntermediateExceptionDelegationResultListener(Future<T> future)
Create a new listener.IntermediateExceptionDelegationResultListener(Future<T> future, IFunctionalResultListener<E> intermediateResultListener, IFunctionalResultListener<java.lang.Void> finishedListener)
Create a new listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commandAvailable(java.lang.Object command)
Called when a command is available.void
customResultAvailable(java.util.Collection<E> result)
Called when the result is available.void
exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.void
exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.void
finished()
Declare that the future is finished.void
finishedIfUndone()
Declare that the future is finished.void
intermediateResultAvailable(E result)
Called when an intermediate result is available.void
intermediateResultAvailableIfUndone(E result)
Called when an intermediate result is available.boolean
isUndone()
Get the undone.void
resultAvailable(java.util.Collection<E> result)
Called when the result is available.void
resultAvailableIfUndone(java.util.Collection<E> result)
Called when the result is available.
-
-
-
Field Detail
-
undone
protected boolean undone
The undone flag.
-
intermediateResultListener
protected IFunctionalResultListener<E> intermediateResultListener
Custom functional result listener
-
finishedListener
protected IFunctionalResultListener<java.lang.Void> finishedListener
Custom functional finished listener
-
-
Constructor Detail
-
IntermediateExceptionDelegationResultListener
public IntermediateExceptionDelegationResultListener(Future<T> future, IFunctionalResultListener<E> intermediateResultListener, IFunctionalResultListener<java.lang.Void> finishedListener)
Create a new listener.- Parameters:
future
- The delegation target.intermediateResultListener
- Functional intermediate result Listener. Can benull
.finishedListener
- Functional finished listener. Can benull
.
-
-
Method Detail
-
resultAvailable
public void resultAvailable(java.util.Collection<E> result)
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:
resultAvailable
in interfaceIFunctionalResultListener<E>
- Parameters:
result
- The final result.
-
intermediateResultAvailable
public void intermediateResultAvailable(E result)
Called when an intermediate result is available.- Specified by:
intermediateResultAvailable
in interfaceIFunctionalIntermediateResultListener<E>
- Specified by:
intermediateResultAvailable
in 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:
finished
in interfaceIFunctionalIntermediateFinishedListener<E>
- Specified by:
finished
in interfaceIIntermediateResultListener<E>
-
customResultAvailable
public void customResultAvailable(java.util.Collection<E> result)
Called when the result is available.- Parameters:
result
- The result.
-
exceptionOccurred
public void exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurred
in interfaceIFunctionalExceptionListener
- Parameters:
exception
- The exception.
-
resultAvailableIfUndone
public void resultAvailableIfUndone(java.util.Collection<E> result)
Called when the result is available.- Specified by:
resultAvailableIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurredIfUndone
public void exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
exception
- The exception.
-
intermediateResultAvailableIfUndone
public void intermediateResultAvailableIfUndone(E result)
Called when an intermediate result is available.- Specified by:
intermediateResultAvailableIfUndone
in 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:
finishedIfUndone
in interfaceIUndoneIntermediateResultListener<E>
-
commandAvailable
public void commandAvailable(java.lang.Object command)
Called when a command is available.- Specified by:
commandAvailable
in interfaceIFutureCommandResultListener<E>
-
isUndone
public boolean isUndone()
Get the undone.- Returns:
- The undone.
-
-