- java.lang.Object
-
- org.snmp4j.agent.NotificationTask
-
- All Implemented Interfaces:
java.lang.Runnable
,org.snmp4j.util.WorkerTask
public class NotificationTask extends java.lang.Object implements org.snmp4j.util.WorkerTask
TheNotificationTask
is aRunnable
that sends a notifcation or a series of notifications/traps/informs - depending on the configuration associated with the suppliedNotificationOriginator
.- Version:
- 1.9
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description NotificationTask(NotificationOriginator notificationOriginator, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUptime, org.snmp4j.smi.VariableBinding[] vbs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.snmp4j.smi.OctetString
getContext()
org.snmp4j.smi.OID
getNotificationID()
NotificationOriginator
getNotificationOriginator()
org.snmp4j.event.ResponseEvent<?>[]
getResponses()
Returns an array of ResponseEvent instances.org.snmp4j.smi.TimeTicks
getSysUpTime()
org.snmp4j.smi.VariableBinding[]
getVariableBindings()
void
interrupt()
void
join()
void
run()
Send the notification a notify this object afterwards.void
terminate()
This method does nothing by default, because this task cannot be terminated gracefully while being executed.
-
-
-
Constructor Detail
-
NotificationTask
public NotificationTask(NotificationOriginator notificationOriginator, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUptime, org.snmp4j.smi.VariableBinding[] vbs)
-
-
Method Detail
-
run
public void run()
Send the notification a notify this object afterwards.- Specified by:
run
in interfacejava.lang.Runnable
-
getContext
public org.snmp4j.smi.OctetString getContext()
-
getNotificationID
public org.snmp4j.smi.OID getNotificationID()
-
getNotificationOriginator
public NotificationOriginator getNotificationOriginator()
-
getResponses
public org.snmp4j.event.ResponseEvent<?>[] getResponses()
Returns an array of ResponseEvent instances. Since theNotificationOriginator
determines on behalf of the SNMP-NOTIFICTON-MIB contents whether a notification is sent as trap/notification or as inform request, the returned array contains an element for each addressed target, but only a response PDU for inform targets.- Returns:
- an array of ResponseEvent instances (informs) or
null
values (for traps/notifications).
-
getSysUpTime
public org.snmp4j.smi.TimeTicks getSysUpTime()
-
getVariableBindings
public org.snmp4j.smi.VariableBinding[] getVariableBindings()
-
terminate
public void terminate()
This method does nothing by default, because this task cannot be terminated gracefully while being executed.- Specified by:
terminate
in interfaceorg.snmp4j.util.WorkerTask
-
join
public void join() throws java.lang.InterruptedException
- Specified by:
join
in interfaceorg.snmp4j.util.WorkerTask
- Throws:
java.lang.InterruptedException
-
interrupt
public void interrupt()
- Specified by:
interrupt
in interfaceorg.snmp4j.util.WorkerTask
-
-