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

Superhac007 superhac007 at gmail.com
Wed Apr 18 16:55:48 CEST 2007


Hi Joke,

I would assume it would be the same given the example from the SNMP4j
package summary for asynchronous.  Though I haven't utilized the
asynchronous pattern.  In the example you are passing the Listener as
parameter to the snmp.sendPDU request.  The only case where it wouldn't be
is if there was an addListener for the SNMP class or the TRANSPORT class.
Which is not the case in the example.   In this case you would remove the
listeners first. Then just do the same as the destroy method for the
synchronous connections.  I would think the snmp.close() method would do
this for you, but I don't know for sure since I haven't looked at the
source.

Regards,

Steve

On 4/18/07, Joke Verhegghe <joke.verhegghe at ugent.be> wrote:
>
> Hey,
>
> Thanks for the mail. I had an outOfMemoryError yesterday, and this solved
> the problem. Do you know the correct way to shutdown asynchronous send
> connection?
>
> Greetz,
> Joke Verhegghe
>
> > 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();
> >         }
> >
> >     }
> > _______________________________________________
> > SNMP4J mailing list
> > SNMP4J at agentpp.org
> > http://lists.agentpp.org/mailman/listinfo/snmp4j
> >
> >
>
>
>



More information about the SNMP4J mailing list