code: public void run()
     {
        this.currentThread = Thread.currentThread();
        this.running.set(true);
  
        while (this.running.get())
        {
           Task nextTask = null;
           try
           {
              if (_logger.isDebugEnabled())
                 _logger.debug("Waiting for next task...");
              nextTask = this.taskSet.take();
              if (_logger.isDebugEnabled())
                 _logger.debug("next from taskset is task: " + nextTask.getCommand());
              this.executor.submit(nextTask);
              if (_logger.isDebugEnabled())
                 _logger.debug("submitted for execution command: " + nextTask.getCommand());
           }
           catch (InterruptedException e)
           {
              _logger.debug("Task manager thread interrupted.");
              this.running.set(false);
           }
           catch (Exception e)
           {
              _logger.debug("Task manager experienced an unhandled exception, shutting down");
              this.running.set(false);
           }
        }
        _logger.info("Shutting down task manager.");
  
        this.taskSet.clear();
        executor.shutdown();
     }
docs: TaskManager implementation