[SNMP4J] Proper way to shutdown a synchronous send connection. e.g. terminate all instances of snmp4j

Superhac007 superhac007 at gmail.com
Tue Apr 17 21:57:50 CEST 2007


Just a post for those who end up with runaway threads after creating
numerous connection instances.  The destroy method cleanly terminates the
instance.


 private void setup() throws IOException {

        // inits
        targetAddress = GenericAddress.parse("udp:"+ipAddress+"/161");
        transport = new DefaultUdpTransportMapping();

        snmp = new Snmp(transport);
        transport.listen();
    }

 // this looks to remove all ruminates of a snmp4j instance.
  public void destroy()
    {

        try {
            transport.close();
            snmp.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

    }



More information about the SNMP4J mailing list