code: public void addTaskAndWakeup(Runnable task) {
          taskQueue.add(task);
          if (selectMode != SELECT_NOW) {
              selector.wakeup();
          }
      }
docs: Adds a task to be executed by the NioThread and wakes up the selector so that it will
  eventually pick up the task.
  
  @param task the task to add.
  @throws NullPointerException if task is null