Net-informations.com
SiteMap  | About    

Daemon thread in Java

Daemon thread is a service provider thread that provides services to the user thread. Daemon thread which runs in background and mostly created by JVM for performing background task like Garbage collection and other house keeping tasks. If normal threads are not running and remaining threads are daemon threads then the interpreter exits.

Daemon thread has :

  1. Very low priority.
  2. Daemon threads acts as services in Windows.
  3. Only executes when no other thread of the same program is running.
  4. JVM ends the program finishing these threads, when daemon threads are the only threads running in a program.

You can use the setDaemon(boolean) method to change the Thread daemon properties before the thread starts. Also use isDaemon() method to check if a thread is a daemon thread or a user thread.









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.