Package io.vertx.core

## Interface Timer

- All Superinterfaces:
    `AsyncResult<Void>`, `Comparable<Delayed>`, `Delayed`, `Future<Void>`

      public interface Timer
      extends Future<Void>, Delayed

  A timer task that can be used as a future. The future is completed when the timeout expires, when the task is cancelled the future is failed with a `CancellationException`.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `cancel()` | Attempt to cancel the timer task, when the timer is cancelled, the timer is failed with a `CancellationException`.
    `int` | `compareTo​(Delayed o)` |
    `long` | `getDelay​(TimeUnit unit)` |

    - ### Methods inherited from interface io.vertx.core.Future

      `andThen, andThen, await, await, cause, compose, compose, eventually, expecting, failed, flatMap, isComplete, map, map, mapEmpty, onComplete, onComplete, onComplete, onFailure, onSuccess, otherwise, otherwise, otherwiseEmpty, recover, result, succeeded, timeout, toCompletionStage, transform, transform`

- - ### Method Detail

    - #### cancel

          boolean cancel()

      Attempt to cancel the timer task, when the timer is cancelled, the timer is failed with a `CancellationException`.
      Returns:
        `true` when the future was cancelled and the timeout didn't fire.

    - #### getDelay

          long getDelay​(TimeUnit unit)

      Specified by:
        `getDelay` in interface `Delayed`

    - #### compareTo

          int compareTo​(Delayed o)

      Specified by:
        `compareTo` in interface `Comparable<Delayed>`