-
- All Implemented Interfaces:
public class EventDispatcherThis is a utility class used for dispatching incoming request events. We use this class mainly (and probably solely) for its ability to handle listener proxies (i.e. listeners interested in requests received on a particular NetAccessPoint only).
-
-
Constructor Summary
Constructors Constructor Description EventDispatcher()Initializes a new EventDispatcher instance.
-
Method Summary
Modifier and Type Method Description voidaddIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)Registers a specific MessageEventHandler for notifications about STUN indications received at a specific local TransportAddress. voidaddOldIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)Registers a specific MessageEventHandler for notifications about old indications received at a specific local TransportAddress. voidaddRequestListener(RequestListener listener)Add a RequestListener to the listener list. voidaddRequestListener(TransportAddress localAddr, RequestListener listener)Add a RequestListener for a specific NetAccessPoint. voidremoveRequestListener(RequestListener listener)Remove a RquestListener from the listener list. voidremoveRequestListener(TransportAddress localAddr, RequestListener listener)Remove a RequestListener for a specific NetAccessPointDescriptor. voidfireMessageEvent(StunMessageEvent evt)Dispatch a StunMessageEvent to any registered listeners. booleanhasRequestListeners(TransportAddress localAddr)Check if there are any listeners for a specific address. voidremoveAllListeners()Removes (absolutely all listeners for this event dispatcher). -
-
Method Detail
-
addIndicationListener
void addIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)
Registers a specific MessageEventHandler for notifications about STUN indications received at a specific local TransportAddress.
- Parameters:
localAddr- the local TransportAddress STUN indications received at which are to be reported to the specified indicationListenerindicationListener- the MessageEventHandler which is to be registered for notifications about STUN indications received at the specified local TransportAddress
-
addOldIndicationListener
void addOldIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)
Registers a specific MessageEventHandler for notifications about old indications received at a specific local TransportAddress.
- Parameters:
localAddr- the local TransportAddress STUN indications received at which are to be reported to the specified indicationListenerindicationListener- the MessageEventHandler which is to be registered for notifications about old indications received at the specified local TransportAddress
-
addRequestListener
void addRequestListener(RequestListener listener)
Add a RequestListener to the listener list. The listener is registered for requests coming from no matter which NetAccessPoint.
- Parameters:
listener- The RequestListener to be added
-
addRequestListener
void addRequestListener(TransportAddress localAddr, RequestListener listener)
Add a RequestListener for a specific NetAccessPoint. The listener will be invoked only when a call on fireRequestReceived is issued for that specific NetAccessPoint.
- Parameters:
localAddr- The NETAP descriptor that we're interested in.listener- The ConfigurationChangeListener to be added
-
removeRequestListener
void removeRequestListener(RequestListener listener)
Remove a RquestListener from the listener list. This removes a RequestListener that was registered for all NetAccessPoints and would not remove listeners registered for specific NetAccessPointDescriptors.
- Parameters:
listener- The RequestListener to be removed
-
removeRequestListener
void removeRequestListener(TransportAddress localAddr, RequestListener listener)
Remove a RequestListener for a specific NetAccessPointDescriptor. This would only remove the listener for the specified NetAccessPointDescriptor and would not remove it if it was also registered as a wildcard listener.
- Parameters:
localAddr- The NetAPDescriptor that was listened on.listener- The RequestListener to be removed
-
fireMessageEvent
void fireMessageEvent(StunMessageEvent evt)
Dispatch a StunMessageEvent to any registered listeners.
- Parameters:
evt- The request event to be delivered.
-
hasRequestListeners
boolean hasRequestListeners(TransportAddress localAddr)
Check if there are any listeners for a specific address. (Generic listeners count as well)
- Parameters:
localAddr- the NetAccessPointDescriptor.
-
removeAllListeners
void removeAllListeners()
Removes (absolutely all listeners for this event dispatcher).
-
-
-
-