Package org.apache.polaris.nosql.async
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 Summary
Modifier and TypeMethodDescriptiondefault Cancelable<Void> This is a convenience function forschedule(Callable, Duration)with a void result, using aRunnable.<R> Cancelable<R> default Cancelable<Void> schedulePeriodic(Runnable runnable, Duration delay) Schedules a runnable to be executed repeatedly using the given initial delay.schedulePeriodic(Runnable runnable, Duration initialDelay, Duration delay) Schedules a runnable to be executed repeatedly, starting after the given initial delay.default <R> Cancelable<R>
-
Method Details
-
submit
-
schedule
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 executedelay- the execution delay, zero and negative values mean immediate scheduling- Returns:
- the cancelable for the scheduled task
-
schedule
This is a convenience function forschedule(Callable, Duration)with a void result, using aRunnable. -
schedulePeriodic
Schedules a runnable to be executed repeatedly using the given initial delay. This is equivalent to callingschedulePeriodic(Runnable, Duration, Duration)with theinitialDelayanddelayhaving the same values.There is intentionally no variant of
schedulePeriodic()that takes aCallablebecause there are multiple invocations of the runnable. -
schedulePeriodic
Schedules a runnable to be executed repeatedly, starting after the given initial delay.There is intentionally no variant of
schedulePeriodic()that takes aCallablebecause there are multiple invocations of the runnable.- Parameters:
runnable- the runnable to executeinitialDelay- initial delay, zero and negative values mean immediate schedulingdelay- repetition delay, zero and negative cause anIllegalArgumentException- Returns:
- cancelable instance
-