public class ConcurrentTest {
private static int threadCount = 10;
public static void main(String[] args) {
final CountDownLatch countDownLatch = new CountDownLatch(threadCount);
for (int i = 0; i < threadCount; i++) {
new Thread(new Runnable() {
public void run() {
try {
countDownLatch.await();
System.out.println("线程开始了---"+Thread.currentThread().getName());
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
countDownLatch.countDown();
}
}
}
java模拟高并发
最新推荐文章于 2024-02-25 19:32:19 发布