• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

What is a daemon/non-daemon thread

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What r daemon/non-daemon threads?
In complete reference,it is written that main thread should be the last thread to finish,so use join(),but elsewhere it is written that JVM exits only when all non-daemon threads are dead.
I had a program where main thread throws an exception,and the thread it creates finishes quite later,but creates all the expected output.Then condition of complete ref. is not satisfied.
I think i have the concepts wrong.
Can u help me,
thanx in advance,
best regards
leena
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi leena,
Hope this discussion helps
http://www.javaranch.com/ubb/Forum24/HTML/001830.html

Indu
 
leena rane
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx a lot Indu,
take care,
leena.
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you dont want the main program to wait for the thread to end you set the code as setDaemon(true).
The JVM does not exist until all the non Daemon threads finish executing. Garbage collector is a non Daemon thread.

vidhya
 
leena rane
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Vidya
>The JVM does not exit until all the non Daemon threads finish >executing. Garbage collector is a non Daemon thread.
can u further explain me about garbage collector thread.
Does it mean the program jvm will not exit until garbage collector thread completes it's work.
Also what is the difference between:
jvm exits only when ........
and interpreter exits only when ...........
thanx in advance,
Best Regards ,
leena
 
reply
    Bookmark Topic Watch Topic
  • New Topic