Class ReservedThreadExecutor

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.thread.ReservedThreadExecutor
All Implemented Interfaces:
Executor, Dumpable, LifeCycle, TryExecutor

@ManagedObject("A pool for reserved threads") public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExecutor, Dumpable

A TryExecutor using pre-allocated/reserved threads from an external Executor.

Calls to tryExecute(Runnable) on ReservedThreadExecutor will either succeed with a reserved thread immediately being assigned the task, or fail if no reserved thread is available.

Threads are reserved lazily, with new reserved threads being allocated from the external Executor passed to the constructor. Whenever 1 or more reserved threads have been idle for more than getIdleTimeoutMs() then one reserved thread will return to the external Executor.