docs: protected Task nextTask() {
  
          try {
              while (!this.isShutdown || Thread.interrupted()) {
                  long now;
                  long next;
                  long wait;
                  Task task;
  
                  // synchronized to ensure removeTask
                  // applies only to the peeked task,
                  // when the computed wait <= 0
                  synchronized (this.taskQueue) {
                      task = this.taskQueue.peekTask();
  
                      if (task == null) {
  
                          // queue is empty
                          break;
                      }
  
                      now  = System.currentTimeMillis();
                      next = task.next;
                      wait = (next - now);
  
                      if (wait > 0) {
  
                          // release ownership of taskQueue monitor and await
                          // notification of task addition or cancellation,
                          // at most until the time when the peeked task is
                          // next supposed to execute
                          this.taskQueue.park(wait);
  
                          continue;           // to top of loop
                      } else {
                          this.taskQueue.removeTask();
                      }
                  }
  
                  long period = task.period;
  
                  if (period > 0) {           // repeated task
                      if (task.relative) {    // using fixed rate shceduling
                          final long late = (now - next);
  
                          if (late > period) {
  
                              // ensure that really late tasks don't
                              // completely saturate the head of the
                              // task queue
                              period = 0;     /** @todo : is -1, -2 ... fairer? */
                          } else if (late > 0) {
  
                              // compensate for scheduling overruns
                              period -= late;
                          }
                      }
  
                      task.updateSchedule(now, now + period);
                      this.taskQueue.addTask(task);
                  }
  
                  return task;
              }
          } catch (InterruptedException e) {
  
              //e.printStackTrace();
          }
  
          return null;
      }