public void removeWorkers() { if (host != null && host.isWorking == false) { host.stopThread(); host = null; numWorkers--; } if (cook != null && cook.isWorking == false) { cook.stopThread(); cook = null; numWorkers--; } if (cashier != null && cashier.isWorking == false) { cashier.stopThread(); cashier = null; numWorkers--; } synchronized (waiters) { for (WaiterAgent w : waiters) { if (w.isWorking == false) { w.stopThread(); waiters.remove(w); numWorkers--; } } } }