JUC
Kevin在成长
这个作者很懒,什么都没留下…
展开
-
synchronized关键字的使用(待完善)
public class synTest { public static void main(String[] args) { AccountingSync accountingSync = new AccountingSync(); new Thread(()->{ accountingSync.run(); }).start(); } } class AccountingSync implements Runn原创 2020-10-03 09:33:27 · 83 阅读 · 0 评论 -
2.5 驻守后台:守护线程(Daemon)
守护线程:系统的守护者,在后台默默地为系统服务, 比如垃圾回收线程,JIT线程等都可以理解为守护线程。 用户线程:系统的工作线程,执行业务代码的线程,当用户线程结束,只有守护线程存在时,JVM自然退出! 注意:守护线程必须在线程启动前面开启,否则会报出异常:守护线程失败 public class DaemonTest { public static void main(String[] args) throws InterruptedException { Thread t=new原创 2020-10-03 09:14:54 · 111 阅读 · 0 评论