[SNMP4J] snmp4j and timer threads
Philip Yarra
philip.yarra at internode.on.net
Sun Jan 2 09:51:03 CET 2005
Hi, I have been writing a simple test app to get the hang of snmp4j. So far so
good, but I did run into one thing that had me confused for a while:
Unless I issue Snmp.close, the java.util.Timer thread continues to run
(Timer.cancel() is called inside Snmp.close, it seems) which prevented my app
from finishing normally. That could be avoided by changing the instantiation
of the Timer object (Snmp.java, line 157) from:
private Timer timer = new Timer();
to
private Timer timer = new Timer(true);
to create the Timer's thread as a daemon thread, so that if all other threads
have completed, Timer will not prevent the app from finishing.
Does this seem a reasonable idea?
I'm also happy to donate my simple test app if it will be any use (it might
save someone else scratching their head over why there's still an active
thread running).
Regards, Philip.
More information about the SNMP4J
mailing list