package com.ctid.rights.outcall.activity.action;
import java.util.concurrent.CountDownLatch;
public class testCountDownLatch{
public static void main (String[] args) throws Exception{
final CountDownLatch cdl = new CountDownLatch(5);
System.out.println("start");
for(int i=0; i<5; i++){
Thread t = new Thread(){
public void run(){
try {
sleep(1000*10);
System.out.println("sleep");
} catch (InterruptedException e) {
e.printStackTrace();
} finally{
cdl.countDown();
System.out.println("countDown");
}
}
};
t.start();
}
System.out.println("await");
cdl.await();
System.out.println("over");
}
}