• Post Reply Bookmark Topic Watch Topic
  • New Topic

Daemon Thread

 
Vandiyadevan senthan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear ALL,

Could you pls anyone explain about 'Daemon Thread' ?And where is it used?

Kind regards,
Senthan
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daemon threads are low priority threads that provides some service to an application. Garbage Collector thread is an example of daemon thread.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srinivasa Raghavan:
Daemon threads are low priority threads that provides some service to an application. Garbage Collector thread is an example of daemon thread.


Actually, the daemon or non-daemon status is completely unrelated to the priority.

As is clearly documented in the Java API/Spec (RTFM), the daemon or non-daemon status of a thread determines how the thread affects JVM shut-down. The JVM will not shut down while any non-daemon threads are running. In contrast, daemon threads do not prevent shut-down.

Daemon threads are often used for background, clean-up tasks or for services. Sometimes they are run at low priority, but that choice depends on the application.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!