/** * 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(); }
/** * 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(); }