Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Daemon threads

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a daemon thread, what is the difference between a normal thread and a daemon thread?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
a deamon thread is a thread what wil not outlive the main thread.
when the mainthread stops the deamon threads wil also stop..
Robert
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default when a thread is created in java it is a user thread. A thread can be made daemon by using setDaemon().Daemon threads work in background. JVM diffrentiates b/w these threads as follows : When user thread exits JVM checks whether there are more user threads to execute. If none present then JVM exits. It means that when only daemon threads are running JVM shuts down. An example of daemon thread is garbage collection. Daemon threads should be used for background processes..
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deamon thread is used to give service to other thread's ,if in my application all the threads finish there operation, then the Demon thread also exits even if it has not finished its operation.
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/731949/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic