[SNMP4J] snmp4j threads

Frank Fock fock at agentpp.com
Mon Apr 3 08:59:35 CEST 2006


Hello,

Please call Snmp.close() if you do not use a Snmp instance
any longer (although you should think about reusing it).

Best regards,
Frank

dvd at gazeta.pl wrote:
> 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
> 
> 
> 
> 
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list