/** * A method that shuts down all running tasks managed by this instance. * TODO: Call this from the right place. */ public void shutdownTasks() throws InterruptedException { log.info("Shutting down tasks"); for (Task task: this.tasks) { task.shutdown(); } for (Task task : this.tasks) { task.awaitShutdown(1000); } for (Task task : this.tasks) { if (task.cancel()) { log.info("Task {} cancelled.", task.getTaskId()); } else { log.info("Task {} could not be cancelled.", task.getTaskId()); } } }
} else { task.cancel(); log.error("Failure after task submitted for workunit {}", workUnit, e);
/** * A method that shuts down all running tasks managed by this instance. * TODO: Call this from the right place. */ public void shutdownTasks() throws InterruptedException { log.info("Shutting down tasks"); for (Task task: this.tasks) { task.shutdown(); } for (Task task : this.tasks) { task.awaitShutdown(1000); } for (Task task : this.tasks) { if (task.cancel()) { log.info("Task {} cancelled.", task.getTaskId()); } else { log.info("Task {} could not be cancelled.", task.getTaskId()); } } }
} else { task.cancel(); log.error("Failure after task submitted for workunit {}", workUnit, e);