/** * Starts a several copies of jobs. The jobs cannot be started again until * the method {@link #waitDone()} is called * * @param job * @param noCopies * @return {@code true} if the jobs have been started */ public synchronized boolean start(Runnable job, int noCopies) { if (!canStart) return false; this.done = new CountDownLatch(noCopies); Worker worker = new Worker(job, done, Thread.currentThread()); for (int i = 0; i < noCopies; i++) { execute(worker); } canStart = false; checkException(); return true; }