コード例 #1
0
 /**
  * @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;
 }