| Author |
Timer thread isn't daemon. bug or feature?
|
dema rogatkin
Ranch Hand
Joined: Oct 09, 2002
Posts: 294
|
|
|
I noticed that Timer thread isn't daemon, so I can't exit app if I used timer. Does somebody know why Timer thread isn't daemon?
|
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Assuming you're asking about java.util.Timer: it's a feature. Actually the feature is the constructor that takes a parameter where you specify whether the thread should be daemon or not.
|
 |
Purushoth Thambu
Ranch Hand
Joined: May 24, 2003
Posts: 425
|
|
|
Did you check the API?. I see a constructor with boolean (for daemon) as parameter. You can make the Timer daemon to the invoking thread. However since timer is a thread it can't live beyond the scope of invoking process (JVM).
|
 |
dema rogatkin
Ranch Hand
Joined: Oct 09, 2002
Posts: 294
|
|
|
Thanks. I do not use Timer myself, but I notice that my servlet container can't exit since slide servlet uses not daemon thread, like Timer. Now I know that it's feature of slide to create a Timer with daemon=false
|
 |
dema rogatkin
Ranch Hand
Joined: Oct 09, 2002
Posts: 294
|
|
|
A relatate question. What is appropriate way to stop non daemon thread? Thread.stop()? It's depreceated, but probably Ok for exit, right? Should I do specific action if I met JVM thread when enumerate and kill threads? I mean can it affect normal JVM shutdown if I kill system thread by mistake which isn't deamon?
|
 |
 |
|
|
subject: Timer thread isn't daemon. bug or feature?
|
|
|