DEV Community

ChelseaLiu0822
ChelseaLiu0822

Posted on

Main thread and daemon thread

As long as there are threads running, the Java process will not end.
For daemon threads, as long as other non-daemon threads have finished running, even if the code of the daemon thread has not finished executing,
It will force the end of setDaemon(true) and set it as a daemon thread.
The garbage collector is a daemon thread
The Acceptor and Poller threads in Tomcat are both daemon threads

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay