/** * Called by the worker thread to return itself to the * idle pool. */ public void returnWorker (AbstractRxTask worker) { if ( running ) { synchronized (mutex) { used.remove(worker); //if ( idle.size() < minThreads && !idle.contains(worker)) idle.add(worker); if ( idle.size() < maxTasks && !idle.contains(worker)) idle.add(worker); //let max be the upper limit else { worker.setDoRun(false); synchronized (worker){worker.notify();} } mutex.notify(); } }else { worker.setDoRun(false); synchronized (worker){worker.notify();} } }
/** * Called by the worker thread to return itself to the * idle pool. */ public void returnWorker (AbstractRxTask worker) { if ( running ) { synchronized (mutex) { used.remove(worker); //if ( idle.size() < minThreads && !idle.contains(worker)) idle.add(worker); if ( idle.size() < maxTasks && !idle.contains(worker)) idle.add(worker); //let max be the upper limit else { worker.setDoRun(false); synchronized (worker){worker.notify();} } mutex.notify(); } }else { worker.setDoRun(false); synchronized (worker){worker.notify();} } }
/** * Called by the worker thread to return itself to the * idle pool. */ public void returnWorker (AbstractRxTask worker) { if ( running ) { synchronized (mutex) { used.remove(worker); //if ( idle.size() < minThreads && !idle.contains(worker)) idle.add(worker); if ( idle.size() < maxTasks && !idle.contains(worker)) idle.add(worker); //let max be the upper limit else { worker.setDoRun(false); synchronized (worker){worker.notify();} } mutex.notify(); } }else { worker.setDoRun(false); synchronized (worker){worker.notify();} } }