Quantcast
Channel: What is a daemon thread in Java? - Stack Overflow
Viewing all articles
Browse latest Browse all 28

Answer by yoAlex5 for What is a daemon thread in Java?

$
0
0

Java daemon thread

[Daemon process]

Java uses user thread and daemon tread concepts.

JVM flow

1. If there are no `user treads` JVM starts terminating the program2. JVM terminates all `daemon threads` automatically without waiting when they are done3. JVM is shutdown

As you see daemon tread is a service thread for user treads.

  • daemon tread is low priority thread.
  • Thread inherits it's properties from parent thread. To set it externally you can use setDaemon() method before starting it or check it via isDaemon()

Viewing all articles
Browse latest Browse all 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>