- java.lang.Object
-
- org.snmp4j.Snmp.NotificationDispatcher
-
- All Implemented Interfaces:
java.util.EventListener,CommandResponder
- Enclosing class:
- Snmp
public class Snmp.NotificationDispatcher extends java.lang.Object implements CommandResponder
TheNotificationDispatcherdispatches traps, notifications, and to registered listeners.- Since:
- 1.6
- Version:
- 2.5.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Hashtable<Address,TransportMapping<?>>notificationListenersprivate java.util.Hashtable<TransportMapping<?>,CommandResponder>notificationTransports
-
Constructor Summary
Constructors Modifier Constructor Description protectedNotificationDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotificationListener(Address listenAddress, TransportMapping<?> transport, CommandResponder listener)voidcloseAll()TransportMapping<?>getTransportMapping(Address listenAddress)<A extends Address>
voidprocessPdu(CommandResponderEvent<A> event)Process an incoming request, report or notification PDU.booleanremoveNotificationListener(Address listenAddress)protected voidsendInformResponse(CommandResponderEvent<?> event)Sends a RESPONSE PDU to the source address of a INFORM request.
-
-
-
Field Detail
-
notificationListeners
private java.util.Hashtable<Address,TransportMapping<?>> notificationListeners
-
notificationTransports
private java.util.Hashtable<TransportMapping<?>,CommandResponder> notificationTransports
-
-
Method Detail
-
getTransportMapping
public TransportMapping<?> getTransportMapping(Address listenAddress)
-
addNotificationListener
public void addNotificationListener(Address listenAddress, TransportMapping<?> transport, CommandResponder listener)
-
removeNotificationListener
public boolean removeNotificationListener(Address listenAddress)
-
closeAll
public void closeAll()
-
processPdu
public <A extends Address> void processPdu(CommandResponderEvent<A> event)
Description copied from interface:CommandResponderProcess an incoming request, report or notification PDU.- Specified by:
processPduin interfaceCommandResponder- Type Parameters:
A- type of the peerAddress.- Parameters:
event- aCommandResponderEventinstance containing the PDU to process and some additional information returned by the message processing model that decoded the SNMP message.
-
sendInformResponse
protected void sendInformResponse(CommandResponderEvent<?> event) throws MessageException
Sends a RESPONSE PDU to the source address of a INFORM request.- Parameters:
event- theCommandResponderEventwith the INFORM request.- Throws:
MessageException- if the response could not be created and sent.
-
-