[SNMP4J] Threading structure in TestAgent/BaseAgent

pradip de pradip.de at gmail.com
Thu Aug 27 20:35:53 CEST 2009


Hi,
I am trying to understand the threading structure of TestAgent.java for my
own implementation of an SNMP agent. My question is basically regarding the
busy wait that is there with a periodic Thread.sleep(). Why doesnt the
BaseAgent have a while(true) loop around the session.listen() ( which I
believe is a blocking function on incoming requests ) instead of the busy
wait in TestAgent? Or am I missing something here? There must be a listening
mechanims in a loop somewhere that allows the agent to respond to multiple
SNMP requests.
As an associated question, I am trying to have my TestAgent implement a
listener to a messagequeue to send traps out. However, it maybe getting
blocked by the busy wait in the main thread.
I would really appreciate if someone could clarify these points for me and
give me suggestions on how to make the agent also be a subscriber to some
published queueing mechanism to pick up messages for sending traps out.

thanks,
Pradip



More information about the SNMP4J mailing list