[SNMP4J] snmp4j threads
dvd at gazeta.pl
dvd at gazeta.pl
Sun Apr 2 13:40:05 CEST 2006
Hello,
I've a questin concerning threads in snmp4j.
The thing is, when I send synchronous message with snmp4j - there
are being
created 2 threads, which don't end ever.
Each query generates 2 such threads. So, when I send 30 snmp queries
to the
network device, there 60 new threads are being created and not
finished. (I
see them in the windows proccess manager)
What about 500 queries?
Why is it so? (this situate exists when the device answers and when not)
--
My samle code is here:
Address targetAddress = GenericAddress.parse("udp:127.0.0.1/8001");
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setTimeout(200);
target.setRetries(2);
target.setVersion(SnmpConstants.version2c);
TransportMapping transport;
transport= new DefaultUdpTransportMapping();
transport.listen();
Snmp snmp;
snmp = new Snmp(transport);
String tmp="";
PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.1.0")));
pdu.setType(PDU.GET);
ResponseEvent response = snmp.send(pdu, target);
if(response==null) throw new IOException();
tmp=response.getResponse().get(0).getVariable().toString();
System.out.println(tmp);
---
Regards,
Telc
More information about the SNMP4J
mailing list