/*
 * Copyright 2017-present Open Networking Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.atomix.utils.concurrent;

import java.time.Duration;

/**
 * Scheduler.
 */
public interface Scheduler {

  /**
   * Schedules a runnable on the context.
   *
   * @param callback The callback to schedule.
   * @param delay    The delay at which to schedule the runnable.
   */
  Scheduled schedule(Duration delay, Runnable callback);

  /**
   * Schedules a runnable at a fixed rate on the context.
   *
   * @param callback The callback to schedule.
   */
  Scheduled schedule(Duration initialDelay, Duration interval, Runnable callback);

}

@@ -670,16 +670,54 @@
 uration;
+%0Aimport java.util.concurrent.TimeUnit;
 %0A%0A/**%0A *
@@ -794,36 +794,130 @@
 unnable 
-on the context.%0A   *
+after a delay.%0A   *%0A   * @param delay the delay after which to run the callback%0A   * @param timeUnit the time unit
 %0A   * @p
@@ -922,33 +922,33 @@
 @param callback 
-T
+t
 he callback to s
@@ -942,33 +942,283 @@
 callback to 
-schedule.
+run%0A   * @return the scheduled callback%0A   */%0A  default Scheduled schedule(long delay, TimeUnit timeUnit, Runnable callback) %7B%0A    return schedule(Duration.ofMillis(timeUnit.toMillis(delay)), callback);%0A  %7D%0A%0A  /**%0A   * Schedules a runnable after a delay.%0A   *
 %0A   * @param
@@ -1228,12 +1228,9 @@
 lay 
-   T
+t
 he d
@@ -1235,17 +1235,20 @@
  delay a
-t
+fter
  which t
@@ -1253,30 +1253,101 @@
  to 
-schedule the runnable.
+run the callback%0A   * @param callback the callback to run%0A   * @return the scheduled callback
 %0A   
@@ -1458,76 +1458,714 @@
 rate
- on the context.%0A   *%0A   * @param callback The callback to schedule.
+.%0A   *%0A   * @param initialDelay the initial delay%0A   * @param interval the interval at which to run the callback%0A   * @param timeUnit the time unit%0A   * @param callback the callback to run%0A   * @return the scheduled callback%0A   */%0A  default Scheduled schedule(long initialDelay, long interval, TimeUnit timeUnit, Runnable callback) %7B%0A    return schedule(Duration.ofMillis(timeUnit.toMillis(initialDelay)), Duration.ofMillis(timeUnit.toMillis(interval)), callback);%0A  %7D%0A%0A  /**%0A   * Schedules a runnable at a fixed rate.%0A   *%0A   * @param initialDelay the initial delay%0A   * @param interval the interval at which to run the callback%0A   * @param callback the callback to run%0A   * @return the scheduled callback
 %0A   

Add default schedule methods to the Scheduler interface.