com.adventnet.snmp.snmp2
Class SnmpCallback

java.lang.Object
  extended by java.lang.Thread
      extended by com.adventnet.snmp.snmp2.SnmpCallback
All Implemented Interfaces:
java.lang.Runnable

 class SnmpCallback
extends java.lang.Thread

This class starts a thread which monitors if callback has to be called when a response arrives.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SnmpCallback(SnmpSession session)
          Constructs an SnmpCallback object using default IP protocol.
 
Method Summary
(package private)  void close()
          Sets the closeCallback boolean true Wakesup all the waiting Threads
(package private)  void enQ(SnmpClient client, SnmpPDU pdu, int reqid)
          When callback has to be called SnmpSession receiver queues it in the responses vector.
(package private)  void enQ(SnmpPDU pdu)
          After extracting the reqid the PDU is handed over to this thread method by SnmpSession for further processing.
 void run()
          The run method of the thread which checks the 'responses' vector and 'packet' vector and calls the appropriate callback.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpCallback

SnmpCallback(SnmpSession session)
Constructs an SnmpCallback object using default IP protocol.

Method Detail

enQ

void enQ(SnmpClient client,
         SnmpPDU pdu,
         int reqid)
When callback has to be called SnmpSession receiver queues it in the responses vector. The Callback thread processes this queue.

Parameters:
client - This is the application which has registered for handling the PDU.
session - The SnmpSession instance invoking this method.
pdu - the SnmpPDU Object
reqid - the request-id of the packet
See Also:
SnmpClient

enQ

void enQ(SnmpPDU pdu)
After extracting the reqid the PDU is handed over to this thread method by SnmpSession for further processing.

Parameters:
packet - The packet received.
session - handle to the SnmpSession instance invoking this method.
pdu - the SnmpPDU object
See Also:
SnmpSession

run

public void run()
The run method of the thread which checks the 'responses' vector and 'packet' vector and calls the appropriate callback. In case of 'packet' vector this method invokes the processPacket method which does the actual invocation and in case of 'reponses' vector it directly invokes the appropriate Client callback method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

close

void close()
Sets the closeCallback boolean true Wakesup all the waiting Threads