/** * Stops any new tasks from being able to be executed and removes workers from the pool. * <p> * This implementation refuses new submissions after this call. And will NOT interrupt any * tasks which are currently running. However any tasks which are waiting in queue to be run * (but have not started yet), will not be run. Those waiting tasks will be removed, and as * workers finish with their current tasks the threads will be joined. * * @return List of runnables which were waiting to execute */ public List<Runnable> shutdownNow() { workerPool.startShutdown(); List<Runnable> awaitingTasks = taskQueueManager.clearQueue(); workerPool.finishShutdown(); return awaitingTasks; }
/** * Stops any new tasks from being able to be executed and removes workers from the pool. * <p> * This implementation refuses new submissions after this call. And will NOT interrupt any * tasks which are currently running. However any tasks which are waiting in queue to be run * (but have not started yet), will not be run. Those waiting tasks will be removed, and as * workers finish with their current tasks the threads will be joined. * * @return List of runnables which were waiting to execute */ public List<Runnable> shutdownNow() { workerPool.startShutdown(); List<Runnable> awaitingTasks = taskQueueManager.clearQueue(); workerPool.finishShutdown(); return awaitingTasks; }
/** * Removes any tasks waiting to be run. Will not interrupt any tasks currently running if * {@link #tick(ExceptionHandler)} is being called. But will avoid additional tasks from being * run on the current {@link #tick(ExceptionHandler)} call. * <p> * If tasks are added concurrently during this invocation they may or may not be removed. * * @return List of runnables which were waiting in the task queue to be executed (and were now removed) */ public List<Runnable> clearTasks() { return queueManager.clearQueue(); }
/** * Removes any tasks waiting to be run. Will not interrupt any tasks currently running if * {@link #tick(ExceptionHandler)} is being called. But will avoid additional tasks from being * run on the current {@link #tick(ExceptionHandler)} call. * <p> * If tasks are added concurrently during this invocation they may or may not be removed. * * @return List of runnables which were waiting in the task queue to be executed (and were now removed) */ public List<Runnable> clearTasks() { return queueManager.clearQueue(); }