Summary of features of the daemon thread

Source: Internet
Author: User

There are two types of threads: 1. Daemon thread; 2. User thread;

1. Daemon Thread: The daemon thread is the thread that values the thread property Isdaemon's state is true, and the primary role is to provide conditions for the execution of the user thread. Typical applications for daemon threads are Java garbage collection.

The main features are:

A. The thread property Isdaemon has a status of true.

B. When there is no user thread running in the JVM application, the daemon thread ends the run.

C. Turn the thread into a daemon thread by setting the thread's method Setdaemon (true), but the method must be executed before the start () method, after the startup thread, cannot change the thread type halfway

D. If you use the thread pool framework executeservice, the daemon thread will be changed to the user thread, and the priority of the thread will be set to the priority of the normal thread. Executeservice is primarily used to manage threads, and cannot create threads.

E. The daemon thread is transitive, and when the thread is set to a daemon thread, its child threads are also the daemon threads.

2. User thread: The user thread is the thread that we created ourselves when we programmed it, and the thread property Isdaemon to True.

For more detailed information about the daemon thread, refer to this blog: http://blog.csdn.net/u013256816/article/details/50392298

Summary of features of the daemon thread

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.