Gavin Rasa 3.x源碼高手之路 系統(tǒng)架構(gòu)、內(nèi)核算法、源碼實(shí)現(xiàn)講解
import java.util.concurrent.CountDownLatch;public class Main {
?public static void main(String[] args) throws InterruptedException {
? ?CountDownLatch latch = new CountDownLatch(10);
? ?for (int i = 0; i < 10; i++) {
? ? ?int finalI = i;
? ? ?new Thread(() -> {
? ? ? ?int second = new Random().nextInt(10);
? ? ? ?try {
? ? ? ? ?Thread.sleep(second * 10
標(biāo)簽: