利用Executors.newSingleThreadScheduledExecutor()创建一个定时任务线程案例,其中利用CountDownLatch闭锁进行阻塞
public static void main(String[] args) throws ExecutionException, InterruptedException {
AtomicInteger count = new AtomicInteger();
Thread thread = Thread.currentThread();
thread.setName("thread-1");//覆盖一下当前线程
String name =
原创
2022-03-26 17:59:08 ·
6273 阅读 ·
0 评论