This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Daemon Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Daemon Threads" Watch "Daemon Threads" New topic
Author

Daemon Threads

Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Hi all,
Just to clear something up. What are daemon threads?
If you have created a Thread and you call setDaemon() on it. What exactly are you doing to the thread?
Thx
Brian
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

Daemon threads die when the thread that created them dies. non-daemon threads do not. If a thread is a daemon, then any threads it creates will automatically be daemons.

SCJP
Visit my download page
Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Thanks for clearing that up for me Randall
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
"Daemon threads die when the thread that created them dies. non-daemon threads do not."
NO NO NO NO NO
A Java program quits when the only Threads left are Daemon threads. (ie all user Threads have died) Thats because Daemon Threads carry on all of the JVM's background activities. There IS NO parent-child relationship among Threads. A Thread only has a ThreadGroup - not a parent.
Bill


------------------
author of:
Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Ok,
Thanks Bill. BTW, did your 70 q's last Fri. good exam... some tricky questions on it.
Once again,
Cheers
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

thanks bill. i know my second statement was right. thanks for clearing up the first part.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Daemon Threads
 
Similar Threads
what is daemon threads
Priority of Daemon threads
Garbage Collector
daemon threads
Daemon threads on SCJP v1.4 exam