• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

what does daemon thread means?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone plz explain
thank u.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jenny raj:
can anyone plz explain
thank u.



Normally, when you start a new Thread, the JVM will not terminate while that thread is running. This means you need to monitor it and terminate it yourself when you want to shut the application down.

A daemon thread, by contrast, will not stop the JVM from terminating. They are good for tasks such as regular monitoring of events, or periodic polling of external systems (amongst other uses). Because they don't stop the JVM from terminating, you can treat them as "fire-and-forget" - launch them once at startup and don't worry anymore.

The event-polling thread in a Swing or AWT application is an example of a daemon thread.

(The terminolgy comes from Unix - a daemon process is one that is detached from your normal terminal session)
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent overview. Robert put it so much better than the JavaDoc which says something backwards about the JVM can terminate when all threads that are not daemon threads have ended. You have to work out the missing wods that daemon threads will not prevent the JVM from terminating.
 
If you're gonna buy things, buy this thing and I get a fat kickback:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic