SimulationThread.java |
package org.lucci.madhoc.simulation; public abstract class SimulationThread extends Thread { private Lock lock; public final void run() { userRun(); if (!lock.getRunningThreads().remove(this)) new Error("thread could not be removed").printStackTrace(); // if this was the last thread to complete if (lock.getRunningThreads().isEmpty()) { lock.getThreadToLock().notify(); } } public abstract void userRun(); }