public class Leader { public static void main(String[] args) throws Throwable { CountDownLatch startSignal = new CountDownLatch(1); CountDownLatch developerDoneSignal = new CountDownLatch(8); CountDownLatch testerDoneSignal = new CountDownLatch(8);
// 找到测试人员 // 找到开发者 for (int i = 0; i < 8; ++i) { new Thread(new Tester(startSignal, developerDoneSignal, testerDoneSignal)).start(); new Thread(new Developer(startSignal, developerDoneSignal)).start(); }
static class Tester implements Runnable { private final CountDownLatch testCaseStartSignal; private final CountDownLatch testStartSignal; private final CountDownLatch doneSignal;
design Write Test case Develop Write Test case Develop Write Test case Develop Write Test case Write Test case Develop Develop Develop Write Test case Write Test case Develop Write Test case Develop Test Test Test Test Test Test Test Test done