追着幸福跑|两分钟浅述DaemonThread守护线程(附英文)
大家都知道 , 在Java中有两种线程:User Thread(用户线程)和DaemonThread(守护线程) 。 那它们有何区别呢?
守护线程
What is Daemon thread?Daemon thread is a low priority thread that runs in background to perform tasks such as garbage collection.
守护线程是一个低优先级的线程 , 它在后台运行 , 执行像垃圾收集等任务 。
Properties:
1.They can not prevent the JVM from exiting when all the user threads finish their execution.
它们不能阻止JVM在所有用户线程执行完毕后退出 。
2.JVM terminates itself when all user threads finish their execution.
当所有用户线程执行完毕后 , JVM自行终止 。
3.If JVM finds running daemon thread, it terminates the thread and after that shutdown itself. JVM does not care whether Daemon thread is running or not.
如果JVM发现正在运行的守护进程线程 , 它就会终止该线程 , 然后关闭自己 。 JVM并不关心Daemon线程是否在运行 。
4.It is an utmost low priority thread.
【追着幸福跑|两分钟浅述DaemonThread守护线程(附英文)】守护线程是一个最低级别的线程 。
推荐阅读
- 笙笙千离|惠若琪李宇春同框颁奖,春春身高176还自卑,巨人身高收获幸福
- 资讯早知道|9年后再看《步步惊心》,发现若曦无论跟谁都不会幸福
- 弹钢琴|原创吉娜为1岁宠物兔庆生,郎朗弹钢琴助兴,幸福温馨像一家三口
- 人民日报|岳阳君山区:消费扶贫托起贫困户稳稳的幸福
- “全国人大 ”微信公众号|何健忠:以实施民法典提升人民美好生活的“幸福指数”
- 经济日报-中国经济网|【幸福花开新边疆】219国道旁的“脱贫事”
- 新华网|【幸福花开新边疆】奋发学技能 靠己奔小康
- 【幸福花开新边疆】奋发学技能 靠己奔小康
- 【幸福花开新边疆】219国道旁的“脱贫事”
- 岳阳君山区:消费扶贫托起贫困户稳稳的幸福
