wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what is daemon threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what is daemon threads" Watch "what is daemon threads" New topic
Author

what is daemon threads

Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
what is daemon threads
Kavitha Govindaraj
Greenhorn

Joined: May 27, 2004
Posts: 28
Any Java thread can be a daemon thread. Daemon threads are service providers for other threads running in the same process as the daemon thread. For example, the HotJava browser uses up to four daemon threads named "Image Fetcher" to fetch images from the file system or network for any thread that needs one. The run() method for a daemon thread is typically an infinite loop that waits for a service request.

When the only remaining threads in a process are daemon threads, the interpreter exits. This makes sense because when only daemon threads remain, there is no other thread for which a daemon thread can provide a service.

To specify that a thread is a daemon thread, call the setDaemon() method with the argument true. To determine if a thread is a daemon thread, use the accessor method isDaemon().


Thanks <br />Kavitha G <br />SCJP
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Garbage collection thread is a deamon thread.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
 
 
subject: what is daemon threads
 
Similar Threads
Unclear
regarding threads
tomcat don�t release port 8080 when on shot down
Daemon Threads
Priority of Daemon threads