code: 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());
        }
      }
    }
docs: A method that shuts down all running tasks managed by this instance.
  TODO: Call this from the right place.