???????????
????wait??notify??notifyAll??java??Object???????????????????????п???????Щ??????????????????
????notify???????????????notifyAll???????е??????
????CountDownLatch??????????????????????????????????CountDownLatch???count???????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????

CountDownLatch latch = new CountDownLatch(5);
for(int i=0;i<5;i++) {
threadPool.execute(new MyRunnable(latch??datas));
}
latch.await();
//do something ???????
????MyRunnable????????????
public void run() {
//do something????????
latch.countDown();
//??????????????????CyclicBarrier???????????????
}

????CyclicBarrier????????Э???????????????????????????????????????????????????????????????????к?????????
???????CyclicBarrier??????д????????????
?????????????

CyclicBarrier barrier = new CyclicBarrier(5+1); //??????????????await??????+1
for(int i=0;i<5;i++) {
threadPool.execute(new MyRunnable(barrier??datas));//?????????????????????????
}
barrier.await();
//???????
????MyRunnable????????
????public void run() {
????//????????
????barrier.await();
????}
????//??? count+1 await??????????????????????????????
?????????
????Semaphore??????????????????????????????????????????????????????????????????????????1??????????????????
??????????????????????????????????????????
semaphore.acquire(count);
try {
//??????????
}
finally {
semaphore.release(count);
}

??????????????
????Exchanger??????????????????????????????????????Exchanger??exchange?????????????????????????????Exchanger??exchanger?????????????н???????????????????????????????

public class TestExchanger {
static Exchanger exchanger = new Exchanger();
public static void main(String[] args) {
new Thread() {
public void run() {
int a = 1;
try {
a = (int) exchanger.exchange(a);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Thread1: "+a);
}
}.start();
new Thread() {
public void run() {
int a = 2;
try {
a = (int) exchanger.exchange(a);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Thread2: "+a);
}
}.start();
}
}
????????????

????Thread2: 1
????Thread1: 2
????????????
????CopyOnWrite?·????????????????????д????????????????????????????????????????д???????????д?????????????????
??????Concurrent??????????????????????????????????????????????????????д??????????????