?????????仹???Щ????????
??????????
????int await()
?????????в???????????? barrier ????? await ?????????????????
????int await(long timeout?? TimeUnit unit)
?????????в????????????????????? await ?????????????????
????int getNumberWaiting()
????????????????????????????????
????int getParties()
???????????????? barrier ????????????
????boolean isBroken()
????????????????????????
????void reset()
???????????????????????
????????
???????????CyclicBarrier?????ò?????????????????????CountDownLatch
????CyclicBarrier??????????????????await()??????????????????????????????????????????
????CountDownLatch???????????????????????await()??????????е????????????????????????????????????
????public class CountDownLatchTest {
????static CountDownLatch c = new CountDownLatch(2);
????public static void main(String[] args) throws InterruptedException {
????new Thread(new Runnable() {
????@Override
????public void run() {
????System.out.println(1);
????//???м?????????-1
????c.countDown();
????System.out.println(2);
????//???м?????????-1
????c.countDown();
????}
????}).start();
????//???????????
????c.await();
????System.out.println("3");
????}
????}
????CountDownLatch????????0?????????????????CyclicBarrier????????????????????0????????
????CountDownLatch??ε???countDown()?????????????????await()??????????????????????κ????
????CyclicBarrier??????await()??????????await()??????????1?????1???????????????????????????????
???????????
????public CountDownLatch(int count);
????public void countDown();
????public void await() throws InterruptedException