Interface TryExecutor

All Superinterfaces:
Executor
All Known Implementing Classes:
DelegatingThreadPool, ExecutorThreadPool, MonitoredQueuedThreadPool, QueuedThreadPool, ReservedThreadExecutor, TryExecutor.NoTryExecutor

public interface TryExecutor extends Executor
A variation of Executor that can confirm if a thread is available immediately
  • Field Details

  • Method Details

    • tryExecute

      boolean tryExecute(Runnable task)
      Attempt to execute a task.
      Parameters:
      task - The task to be executed
      Returns:
      True IFF the task has been given directly to a thread to execute. The task cannot be queued pending the later availability of a Thread.
    • execute

      default void execute(Runnable task)
      Specified by:
      execute in interface Executor
    • asTryExecutor

      static TryExecutor asTryExecutor(Executor executor)