aspose file tools
The moose likes Threads and Synchronization and the fly likes Daemon Threads in java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Daemon Threads in java" Watch "Daemon Threads in java" New topic
Author

Daemon Threads in java

Deepika Saxena
Ranch Hand

Joined: Jul 05, 2009
Posts: 59
Hi,
Daemon threads are the low priority threads in java. example is garbage collector. I read that only JVM or OS will have control on Daemon threads.
could any body please tell me can we create our own Daemon Threads in java? if yes, how to do it?
Thanks.
--Deepika
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8441

The thread class has a convenient method setDaemon(boolean isDaemon).
Not a beginners topic. I will move this thread to a more appropriate forum for you.


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35257
    
    7
Whether or not a thread is a daemon thread is independent of its priority (although it's true that most often they have a low priority). Check the javadocs of the java.lang.Thread class for methods that can be used to set/unset the daemon status of a thread.

All that being a daemon means for a running Thread is that it will not keep the JVM from exiting if there are no other non-daemon threads; no more, no less.


Android appsImageJ pluginsJava web charts
Deepika Saxena
Ranch Hand

Joined: Jul 05, 2009
Posts: 59
Thanks Maneesh and Ulf for clarifying this Thread.
--Deepika
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Daemon Threads in java
 
Similar Threads
User and Daemon threads
regarding threads
what is daemon threads
Priority of Daemon threads
What is Demon Thread?