public class EventDispatcher extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
EventDispatcher.IndicationEventHandler
Implements MessageEventHandler for a
MessageEventHandler which handles STUN indications.
|
private static class |
EventDispatcher.MessageTypeEventHandler<T>
Represents the base for providers of MessageEventHandler
implementations to specific Objects.
|
private static class |
EventDispatcher.OldIndicationEventHandler
Implements MessageEventHandler for a
MessageEventHandler which handles old DATA indications (0x0115).
|
private static class |
EventDispatcher.RequestListenerMessageEventHandler
Implements MessageEventHandler for RequestListener.
|
Modifier and Type | Field and Description |
---|---|
private Map<TransportAddress,EventDispatcher> |
children
The Map of EventDispatchers which keep the
registrations of STUN request and indication listeners registered for
STUN requests and indications from specific local
TransportAddresses.
|
private List<EventDispatcher.MessageTypeEventHandler<?>> |
messageListeners
The STUN request and indication listeners registered with this
EventDispatcher.
|
Constructor and Description |
---|
EventDispatcher()
Initializes a new EventDispatcher instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addIndicationListener(TransportAddress localAddr,
MessageEventHandler indicationListener)
Registers a specific MessageEventHandler for notifications about
STUN indications received at a specific local TransportAddress.
|
private void |
addMessageListener(EventDispatcher.MessageTypeEventHandler<?> messageListener)
Registers a specific MessageTypeEventHandler for notifications
about received STUN messages.
|
private void |
addMessageListener(TransportAddress localAddr,
EventDispatcher.MessageTypeEventHandler<?> messageListener)
Registers a specific MessageTypeEventHandler for notifications
about STUN messages received at a specific local
TransportAddress.
|
void |
addOldIndicationListener(TransportAddress localAddr,
MessageEventHandler indicationListener)
Registers a specific MessageEventHandler for notifications about
old indications received at a specific local TransportAddress.
|
void |
addRequestListener(RequestListener listener)
Add a RequestListener to the listener list.
|
void |
addRequestListener(TransportAddress localAddr,
RequestListener listener)
Add a RequestListener for a specific NetAccessPoint.
|
void |
fireMessageEvent(StunMessageEvent evt)
Dispatch a StunMessageEvent to any registered listeners.
|
boolean |
hasRequestListeners(TransportAddress localAddr)
Check if there are any listeners for a specific address.
|
void |
removeAllListeners()
Removes (absolutely all listeners for this event dispatcher).
|
private void |
removeMessageListener(EventDispatcher.MessageTypeEventHandler<?> messageListener)
Unregisters a specific MessageTypeEventHandler from
notifications about received STUN messages.
|
private void |
removeMessageListener(TransportAddress localAddr,
EventDispatcher.MessageTypeEventHandler<?> messageListener)
Unregisters a specific MessageTypeEventHandler from
notifications about STUN messages received at a specific local
TransportAddress.
|
void |
removeRequestListener(RequestListener listener)
Remove a RquestListener from the listener list.
|
void |
removeRequestListener(TransportAddress localAddr,
RequestListener listener)
Remove a RequestListener for a specific NetAccessPointDescriptor.
|
private final List<EventDispatcher.MessageTypeEventHandler<?>> messageListeners
private final Map<TransportAddress,EventDispatcher> children
public EventDispatcher()
public void addIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)
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 TransportAddresspublic void addOldIndicationListener(TransportAddress localAddr, MessageEventHandler indicationListener)
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 TransportAddressprivate void addMessageListener(EventDispatcher.MessageTypeEventHandler<?> messageListener)
messageListener
- the MessageTypeEventHandler which is to
be registered for notifications about received STUN messagesprivate void addMessageListener(TransportAddress localAddr, EventDispatcher.MessageTypeEventHandler<?> messageListener)
localAddr
- the local TransportAddress STUN messages
received at which are to be reported to the specified
messageListenermessageListener
- the MessageTypeEventHandler which is to
be registered for notifications about STUN messages received at the
specified local TransportAddresspublic void addRequestListener(RequestListener listener)
listener
- The RequestListener to be addedpublic void addRequestListener(TransportAddress localAddr, RequestListener listener)
localAddr
- The NETAP descriptor that we're interested in.listener
- The ConfigurationChangeListener to be addedprivate void removeMessageListener(EventDispatcher.MessageTypeEventHandler<?> messageListener)
messageListener
- the MessageTypeEventHandler to be
unregistered for notifications about received STUN messagesprivate void removeMessageListener(TransportAddress localAddr, EventDispatcher.MessageTypeEventHandler<?> messageListener)
localAddr
- the local TransportAddress STUN messages
received at which to no longer be reported to the specified
messageListenermessageListener
- the MessageTypeEventHandler to be
unregistered for notifications about STUN messages received at the
specified local TransportAddresspublic void removeRequestListener(RequestListener listener)
listener
- The RequestListener to be removedpublic void removeRequestListener(TransportAddress localAddr, RequestListener listener)
localAddr
- The NetAPDescriptor that was listened on.listener
- The RequestListener to be removedpublic void fireMessageEvent(StunMessageEvent evt)
evt
- The request event to be delivered.public boolean hasRequestListeners(TransportAddress localAddr)
localAddr
- the NetAccessPointDescriptor.public void removeAllListeners()
Copyright © 2018. All rights reserved.