摘要: 在多线程中,有时候需要等待所有线程执行完成后才让继续往下执行,如查询结果汇总等。下面列举两种等待方式: 方式一: 利用 CountDownLatch 类完成。 示例: // 按任务总量创建计数器final CountDownLatch countDownLatch = new CountDownLa 阅读全文
posted @ 2020-06-09 18:05 向阳无痕 阅读(2898) 评论(0) 推荐(0) 编辑