/** * Stop the thread pool */ public synchronized void shutdown() { if(!stopThePool) { stopThePool = true; if (monitor != null) { monitor.terminate(); monitor = null; } for(int i = 0; i < currentThreadCount - currentThreadsBusy; i++) { try { pool[i].terminate(); } catch(Throwable t) { /* * Do nothing... The show must go on, we are shutting * down the pool and nothing should stop that. */ log.error("Ignored exception while shutting down thread pool", t); } } currentThreadsBusy = currentThreadCount = 0; pool = null; notifyAll(); } }
public void stop() { this.terminate(); }
MonitorRunnable(ThreadPool p) { this.p=p; this.start(); }
public synchronized void start() { stopThePool=false; currentThreadCount = 0; currentThreadsBusy = 0; adjustLimits(); pool = new ControlRunnable[maxThreads]; openThreads(minSpareThreads); if (maxSpareThreads < maxThreads) { monitor = new MonitorRunnable(this); } }