donaricano-btn

Daemon Thread

- Daemon Thread is a service provider thread that provides services to the user thread

- Its life depend on the mercy of user thread i.e. all the user threads dies, JVM terminates this thread automatically

- gc, finalizer etc..


1. Points to remember for Daemon Thread

- It provides services to user threads for background supporting tasks

- Its life depends on user thread

- It is a low priority thread

2. Why JVM terminates the daemon thread if there is no user thread?

- The sole purpose of the daemon thread is that it provides services to user thread for background supporting task

- If there is no user thread, we don't need daemon threads

3. Methods for Daemon thread by Thread class

1) public void setDaemon(boolean status)

- It is used to mark the current thread as daemon thread or user thread

2) public boolean isDaemon()

- It is used to check that current is daemon

4. Example



'Back-End > Java_1' 카테고리의 다른 글

[Java] Shutdown Hook  (0) 2016.10.10
[Java] Thread pool  (0) 2016.10.10
[Java] Thread Priority  (0) 2016.10.07
[Java] Naming Thread  (0) 2016.10.07
[Java] Joining a thread  (0) 2016.10.07
블로그 이미지

리딩리드

,