Package org.flowable.common.engine.api.async

# Interface AsyncTaskExecutor

public interface AsyncTaskExecutor
Flowable task executor interface that abstracts the execution of a `Runnable` or `Callable` asynchronously in a different thread.

Author:
  Filip Hrisafov
See Also:
  - `Executor`
  - `ExecutorService`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(Runnable task)`
  Execute the given `task`
  `int`
  `getRemainingCapacity()`
  `void`
  `shutdown()`
  Potentially shutdown the resources used by the async task executor.
  `CompletableFuture<?>`
  `submit(Runnable task)`
  Submit a `Runnable` task for execution, receiving a Future representing the execution of the task.
  `<T> CompletableFuture<T>`
  `submit(Callable<T> task)`
  Submit a `Callable` task for execution, receiving a Future representing the execution of the task.

- ## Method Details

  - ### execute

    void execute(Runnable task)
    Execute the given `task`
    Parameters:
      `task` - the `Runnable` task to execute
    Throws:
      `RejectedExecutionException` - if the given task was not accepted

  - ### submit

    CompletableFuture<?> submit(Runnable task)
    Submit a `Runnable` task for execution, receiving a Future representing the execution of the task.
    Parameters:
      `task` - the `Runnable` to execute
    Returns:
      a `CompletableFuture` representing pending completion of the task
    Throws:
      `RejectedExecutionException` - if the given task was not submitted

  - ### submit

    <T> CompletableFuture<T> submit(Callable<T> task)
    Submit a `Callable` task for execution, receiving a Future representing the execution of the task.
    Parameters:
      `task` - the `Runnable` to execute
    Returns:
      a `CompletableFuture` representing pending completion of the task
    Throws:
      `RejectedExecutionException` - if the given task was not submitted

  - ### shutdown

    void shutdown()
    Potentially shutdown the resources used by the async task executor.

  - ### getRemainingCapacity

    int getRemainingCapacity()