Package groovy.concurrent

# Interface Cancellable

public interface Cancellable
A handle for a scheduled action that can be called off before it fires (or that can have its further firings suppressed, in the case of a recurring schedule).

Returned by `ActorContext.scheduleOnce(Object, java.time.Duration)` and `ActorContext.scheduleAtFixedRate(Object, java.time.Duration, java.time.Duration)`.

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `cancel()`
  Attempts to cancel the scheduled action.
  `boolean`
  `isCancelled()`
  Returns `true` if this scheduled action has been cancelled.

- ## Method Details

  - ### cancel

    boolean cancel()
    Attempts to cancel the scheduled action. Returns `true` if cancellation prevented at least one further firing, `false` if the action had already fired (one-shot), had already been cancelled, or could not be cancelled.

    Idempotent: calling `cancel()` repeatedly is safe.

  - ### isCancelled

    boolean isCancelled()
    Returns `true` if this scheduled action has been cancelled.