org.springframework.scheduling.config

## Class IntervalTask

- java.lang.Object
- - org.springframework.scheduling.config.Task
  - - org.springframework.scheduling.config.IntervalTask

- Direct Known Subclasses:
    FixedDelayTask, FixedRateTask

      public class IntervalTask
      extends Task

  `Task` implementation defining a `Runnable` to be executed at a given millisecond interval which may be treated as fixed-rate or fixed-delay depending on context.
  Since:
    3.2
  Author:
    Chris Beams
  See Also:
    `ScheduledTaskRegistrar.addFixedRateTask(IntervalTask)`, `ScheduledTaskRegistrar.addFixedDelayTask(IntervalTask)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntervalTask(Runnable runnable, long interval)` Create a new `IntervalTask` with no initial delay.
    `IntervalTask(Runnable runnable, long interval, long initialDelay)` Create a new `IntervalTask`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getInitialDelay()` Return the initial delay before first execution of the task.
    `long` | `getInterval()` Return how often in milliseconds the task should be executed.

    - ### Methods inherited from class org.springframework.scheduling.config.Task

      `getRunnable, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### IntervalTask

          public IntervalTask(Runnable runnable,
                              long interval,
                              long initialDelay)

      Create a new `IntervalTask`.
      Parameters:
        `runnable` - the underlying task to execute
        `interval` - how often in milliseconds the task should be executed
        `initialDelay` - the initial delay before first execution of the task

    - #### IntervalTask

          public IntervalTask(Runnable runnable,
                              long interval)

      Create a new `IntervalTask` with no initial delay.
      Parameters:
        `runnable` - the underlying task to execute
        `interval` - how often in milliseconds the task should be executed

  - ### Method Detail

    - #### getInterval

          public long getInterval()

      Return how often in milliseconds the task should be executed.

    - #### getInitialDelay

          public long getInitialDelay()

      Return the initial delay before first execution of the task.