/** Overrides FutureTask version so as to reset/requeue if periodic. */
 public void run() {
   boolean periodic = isPeriodic();
   if (!canRunInCurrentRunState(periodic)) cancel(false);
   else if (!periodic) ScheduledFutureTask.super.run();
   else if (ScheduledFutureTask.super.runAndReset()) {
     setNextRunTime();
     reExecutePeriodic(outerTask);
   }
 }
 /**
  * @throws RejectedExecutionException {@inheritDoc}
  * @throws NullPointerException {@inheritDoc}
  * @throws IllegalArgumentException {@inheritDoc}
  */
 public ScheduledFuture<?> scheduleWithFixedDelay(
     Runnable command, long initialDelay, long delay, TimeUnit unit) {
   if (command == null || unit == null) throw new NullPointerException();
   if (delay <= 0) throw new IllegalArgumentException();
   ScheduledFutureTask<Void> sft =
       new ScheduledFutureTask<Void>(
           command, null, triggerTime(initialDelay, unit), unit.toNanos(-delay));
   RunnableScheduledFuture<Void> t = decorateTask(command, sft);
   sft.outerTask = t;
   delayedExecute(t);
   return t;
 }