Interface AsyncExec


public interface AsyncExec
Abstraction for platform/environment-specific scheduler implementations for delayed and optionally repeated executions.

Quarkus production systems use Vert.x, tests usually use Java executors.

Implementations, like Java executors or Vert.X, are usually @ApplicationScoped in CDI environments.

  • Method Details

    • submit

      default <R> Cancelable<R> submit(Callable<R> callable)
    • schedule

      <R> Cancelable<R> schedule(Callable<R> callable, Duration delay)
      Asynchronously run the given callable after the provided delay. If the delay is not positive, the function is scheduled for immediate execution.
      Type Parameters:
      R - return type of the callable propagated through the returned cancelable
      Parameters:
      callable - the callable to execute
      delay - the execution delay, zero and negative values mean immediate scheduling
      Returns:
      the cancelable for the scheduled task
    • schedule

      default Cancelable<Void> schedule(Runnable runnable, Duration delay)
      This is a convenience function for schedule(Callable, Duration) with a void result, using a Runnable.
    • schedulePeriodic

      default Cancelable<Void> schedulePeriodic(Runnable runnable, Duration delay)
      Schedules a runnable to be executed repeatedly using the given initial delay. This is equivalent to calling schedulePeriodic(Runnable, Duration, Duration) with the initialDelay and delay having the same values.

      There is intentionally no variant of schedulePeriodic() that takes a Callable because there are multiple invocations of the runnable.

    • schedulePeriodic

      Cancelable<Void> schedulePeriodic(Runnable runnable, Duration initialDelay, Duration delay)
      Schedules a runnable to be executed repeatedly, starting after the given initial delay.

      There is intentionally no variant of schedulePeriodic() that takes a Callable because there are multiple invocations of the runnable.

      Parameters:
      runnable - the runnable to execute
      initialDelay - initial delay, zero and negative values mean immediate scheduling
      delay - repetition delay, zero and negative cause an IllegalArgumentException
      Returns:
      cancelable instance