我们经常遇到需要对线程进行阻塞的时候,这时我们可以采用如下方式进行线程阻塞:
import java.util.concurrent.CountDownLatch;
public class Main {
public static void main(Stringp[] args) throw InterruptedException {
CountDownLatch countDownLatch = new CountDownLatch(1);
countDownLatch.await();
}
}
网友评论