private synchronized void reduceWorkforce() throws InterruptedException { verbose("Decrementing workforce from " + mWorkThreads.size()); // push a the right number of kiss of death tasks to shutdown threads. for (int i = 0; i < mMWorkforceIncrement; i++) { _push(new QueueTask<>(QueueTask.ActionType.Death, null)); } }
private synchronized void reduceWorkforce() throws InterruptedException { verbose("Decrementing workforce from " + mWorkThreads.size()); // push a the right number of kiss of death tasks to shutdown threads. for (int i = 0; i < mMWorkforceIncrement; i++) { _push(new QueueTask<T>(QueueTask.ActionType.Death, null)); } }
/** * Shutdowns the working queue and wait until all pending requests have * been processed. This needs to be reviewed as jobs can still be added * to the queue once the shutdown process has started.... * @throws InterruptedException if the shutdown sequence is interrupted */ public synchronized void shutdown() throws InterruptedException { // push as many death pills as necessary for (Thread t : mWorkThreads) { _push(new QueueTask<T>(QueueTask.ActionType.Death, null)); } // we could use a latch. for (Thread t : mWorkThreads) { t.join(); } mWorkThreads.clear(); mQueueThreadContext.shutdown(); }
/** * Shutdowns the working queue and wait until all pending requests have * been processed. This needs to be reviewed as jobs can still be added * to the queue once the shutdown process has started.... * @throws InterruptedException if the shutdown sequence is interrupted */ public synchronized void shutdown() throws InterruptedException { // push as many death pills as necessary for (Thread t : mWorkThreads) { _push(new QueueTask<>(QueueTask.ActionType.Death, null)); } // we could use a latch. for (Thread t : mWorkThreads) { t.join(); } mWorkThreads.clear(); mQueueThreadContext.shutdown(); }
public void push(Job<T> job) throws InterruptedException { _push(new QueueTask<T>(QueueTask.ActionType.Normal, job)); checkWorkforce(); }
public void push(Job<T> job) throws InterruptedException { _push(new QueueTask<>(QueueTask.ActionType.Normal, job)); checkWorkforce(); }