File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes daemon thread Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "daemon thread" Watch "daemon thread" New topic
Author

daemon thread

ramesh kumar
Greenhorn

Joined: Aug 15, 2006
Posts: 25
daemon thread has to terminate immediatly after parent thread terminate,but in my program it is taking some time why?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16690
    
  19

Originally posted by ramesh kumar:
daemon thread has to terminate immediatly after parent thread terminate,but in my program it is taking some time why?


Unfortunately, your premise is incorrect. Daemon threads do not terminate when the parent thread terminates.

Daemon threads do not prevent the JVM from exiting, meaning that if only daemon threads are running the JVM may exit. If even a single user thread is running, the JVM will continue to run, along with the Daemon threads. (And even when exiting, I don't recall any mention of "immediately")

Henry
[ August 18, 2006: Message edited by: Henry Wong ]

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: daemon thread
 
Similar Threads
Daemon
what are daemon threads?
Daemon Threads
How to handle/kill a hung thread
daemon Thread