[SNMP4J] DefaultUdpTransportMapping and Threads

Stefan Majer stefan at x-cellent.com
Tue May 2 20:04:55 CEST 2006


Hi,

Im currently developing a application based on Java5 and EJB3 deployed
to jboss4 as application server. 
The application server fires every minute a snmprequest and a executor
checks if the the request takes longer than a specified timeout.

The snmprequest looks:

transport = new DefaultUdpTransportMapping();
((DefaultUdpTransportMapping)transport).setSocketTimeout(0);
snmp.listen();

...
target.setAddress(targetAddress);
target.setRetries(0);
target.setTimeout(timeout);
target.setVersion(SnmpConstants.version2c);
target.setCommunity(new OctetString(community));
PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID(oid)));
pdu.setType(PDU.GET);
ResponseEvent response = snmp.send(pdu, target);

....
snmp.close();
transport.close();

If host is unreachable or there is no snmpd listen, snmp.close() never
returns and i get one more thread of a DefaultUdpTransportMapping every
request.

When i now set the Timeout for the DefaultUdpTransportMapping to a Value
other than Zero, it works all fine.
But i need to have a Zero Timeout because the timeout reduces the amount
of snmprequest i can send per Intervall.

Any help appreciated

 
Stefan Majer <stefan at x-cellent.com>
x-cellent technologies GmbH




More information about the SNMP4J mailing list