• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Daemon and non-daemon threads

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I read it some where on this forum that JVM exits when main thread exits, but I also read some where else that JVM ONLY exits when there are no more non-daemon threads running. My question is.....what if there are still non-daemon threads running even tho when main thread had already finished? Will JVM then exit because main thread had finished?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what if there are still non-daemon threads running even tho when main thread had already finished? Will JVM then exit because main thread had finished?
No.It will wait till the non-daemon threads are finished.And then JVM exits. check this link whereMahaAnna has explained with example.
Jeban.
reply
    Bookmark Topic Watch Topic
  • New Topic