Interface Executor

All Superinterfaces:
AsyncCloseable, Executor, ListenableAsyncCloseable, TimeSource
All Known Subinterfaces:
EventLoopAwareNettyIoExecutor, IoExecutor, NettyIoExecutor
All Known Implementing Classes:
DelegatingExecutor

public interface Executor extends Executor, ListenableAsyncCloseable
A general abstraction to execute immediate and delayed tasks.

Long running tasks

Executor implementations are expected to run long-running (blocking) tasks which may depend on other tasks submitted to the same Executor instance. In order to avoid deadlocks, it is generally a good idea to not allow task queuing in the Executor.
  • Method Details

    • timer

      default Completable timer(long delay, TimeUnit unit)
      Creates a new Completable that will complete after the time duration expires.
      Parameters:
      delay - The time duration which is allowed to elapse between subscribe and termination.
      unit - The units for duration.
      Returns:
      a new Completable that will complete after the time duration expires.
      See Also:
    • timer

      default Completable timer(Duration delay)
      Creates a new Completable that will complete after the time duration expires.
      Parameters:
      delay - The time duration which is allowed to elapse between subscribe and termination.
      Returns:
      a new Completable that will complete after the time duration expires.
      See Also:
    • submit

      default Completable submit(Runnable runnable)
      Create a new Completable that executes the passed Runnable on each subscribe.
      Parameters:
      runnable - The Runnable to execute on each subscribe.
      Returns:
      a new Completable that executes a Runnable on each subscribe.
    • submitRunnable

      default Completable submitRunnable(Supplier<Runnable> runnableSupplier)
      Creates a new Completable that creates and executes a Runnable when subscribed to.
      Parameters:
      runnableSupplier - Supplier to create a new Runnable for every subscribe of the returned Completable.
      Returns:
      A new Completable that creates and executes a new Runnable using runnableSupplier for every subscribe.
    • submit

      default <T> Single<T> submit(Callable<? extends T> callable)
      Creates a new Single that creates and executes the passed Callable when subscribed to.
      Type Parameters:
      T - Type of the Single.
      Parameters:
      callable - The Callable to execute on each subscribe.
      Returns:
      a new Single that obtains a Callable from callableSupplier and executes it on each subscribe.
    • submitCallable

      default <T> Single<T> submitCallable(Supplier<? extends Callable<? extends T>> callableSupplier)
      Create a new Single that obtains a Callable from callableSupplier and executes on each subscribe.
      Type Parameters:
      T - Type of the Single.
      Parameters:
      callableSupplier - Supplier to create a new Callable for every call to subscribe to the returned Single.
      Returns:
      A new Single that creates and executes a new Callable using callableSupplier for every subscribe.