Package jadex.bridge
Class TimeoutResultListener<E>
- java.lang.Object
- 
- jadex.bridge.TimeoutResultListener<E>
 
- 
- All Implemented Interfaces:
- IFunctionalExceptionListener,- IFunctionalResultListener<E>,- IFutureCommandResultListener<E>,- IResultListener<E>,- IUndoneResultListener<E>
 - Direct Known Subclasses:
- TimeoutIntermediateResultListener
 
 public class TimeoutResultListener<E> extends java.lang.Object implements IResultListener<E>, IUndoneResultListener<E>, IFutureCommandResultListener<E> Listener that allows to automatically trigger a timeout when no result (or exception) was received after some timeout interval.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IExternalAccessextaThe external access.protected IResultListener<E>listenerThe delegation listener.protected java.lang.ObjectmessageThe timeout message.protected booleannotifiedThe timeout occurred flag.protected booleanrealtimeThe realtime flag.protected longtimeoutThe timeout.protected java.lang.ObjecttimerThe timer.protected booleanundoneFlag if undone methods should be used.
 - 
Constructor SummaryConstructors Constructor Description TimeoutResultListener(long timeout, IExternalAccess exta)Create a new listener.TimeoutResultListener(long timeout, IExternalAccess exta, boolean realtime, java.lang.Object message, IResultListener<E> listener)Create a new listener.TimeoutResultListener(long timeout, IExternalAccess exta, IResultListener<E> listener)Create a new listener.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancel the timeout.voidcommandAvailable(java.lang.Object command)Called when a command is available.voidexceptionOccurred(java.lang.Exception exception)Called when an exception occurred.voidexceptionOccurredIfUndone(java.lang.Exception exception)Called when an exception occurred.protected voidinitTimer()voidresultAvailable(E result)Called when the result is available.voidresultAvailableIfUndone(E result)Called when the result is available.voidtimeoutOccurred(TimeoutException te)Can be overridden, e.g.
 
- 
- 
- 
Field Detail- 
listenerprotected IResultListener<E> listener The delegation listener.
 - 
extaprotected IExternalAccess exta The external access.
 - 
notifiedprotected boolean notified The timeout occurred flag.
 - 
timerprotected java.lang.Object timer The timer.
 - 
timeoutprotected long timeout The timeout.
 - 
realtimeprotected boolean realtime The realtime flag.
 - 
messageprotected java.lang.Object message The timeout message.
 - 
undoneprotected boolean undone Flag if undone methods should be used.
 
- 
 - 
Constructor Detail- 
TimeoutResultListenerpublic TimeoutResultListener(long timeout, IExternalAccess exta)Create a new listener.
 - 
TimeoutResultListenerpublic TimeoutResultListener(long timeout, IExternalAccess exta, IResultListener<E> listener)Create a new listener.
 - 
TimeoutResultListenerpublic TimeoutResultListener(long timeout, IExternalAccess exta, boolean realtime, java.lang.Object message, IResultListener<E> listener)Create a new listener.
 
- 
 - 
Method Detail- 
resultAvailablepublic void resultAvailable(E result) Called when the result is available.- Specified by:
- resultAvailablein interface- IFunctionalResultListener<E>
- Parameters:
- result- The result.
 
 - 
exceptionOccurredpublic void exceptionOccurred(java.lang.Exception exception) Called when an exception occurred.- Specified by:
- exceptionOccurredin interface- IFunctionalExceptionListener
- Parameters:
- exception- The exception.
 
 - 
resultAvailableIfUndonepublic void resultAvailableIfUndone(E result) Called when the result is available.- Specified by:
- resultAvailableIfUndonein interface- IUndoneResultListener<E>
- Parameters:
- result- The result.
 
 - 
exceptionOccurredIfUndonepublic void exceptionOccurredIfUndone(java.lang.Exception exception) Called when an exception occurred.- Specified by:
- exceptionOccurredIfUndonein interface- IUndoneResultListener<E>
- Parameters:
- exception- The exception.
 
 - 
cancelpublic void cancel() Cancel the timeout.
 - 
initTimerprotected void initTimer() 
 - 
commandAvailablepublic void commandAvailable(java.lang.Object command) Called when a command is available.- Specified by:
- commandAvailablein interface- IFutureCommandResultListener<E>
 
 - 
timeoutOccurredpublic void timeoutOccurred(TimeoutException te) Can be overridden, e.g. when no listener is used.
 
- 
 
-