### Question:
CyclicBarrier { public void await() { myAqs.acquireShared(); if (checkFull()) { pass(); } } CyclicBarrier(int parties, Runnable barrierAction); void await();  }### Answer:
@Test void go() throws InterruptedException { LinkedBlockingQueue<String> waitQueue = new LinkedBlockingQueue<>(); int threadCount = 4; int maxThreadCount = 100; CyclicBarrier cyclicBarrier = new CyclicBarrier(threadCount, new Runnable() { @Override public void run() { String treadName = Thread.currentThread().getName(); System.out.println("有" + threadCount + "个线程执行了，发车~" + treadName); for (int i = 0; i < threadCount; i++) { System.out.println(treadName + "执行出栈：" + waitQueue.poll()); } } }); for (int i = 0; i < maxThreadCount; i++) { String countString = String.valueOf(i); ThreadPoolUtils.getInstance().getExecutorService().execute(() -> { try { waitQueue.put(countString); Thread.sleep(new Random().nextInt(200)); cyclicBarrier.await(); } catch (InterruptedException | BrokenBarrierException e) { e.printStackTrace(); } }); } Thread.sleep(4000L); }