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)