Class VirtualThreadPool

java.lang.Object
All Implemented Interfaces:
Executor, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, ThreadPool, TryExecutor, VirtualThreads.Configurable

@ManagedObject("A thread non-pool for virtual threads") public class VirtualThreadPool extends ContainerLifeCycle implements ThreadPool, Dumpable, TryExecutor, VirtualThreads.Configurable

An implementation of ThreadPool interface that does not pool, but instead uses VirtualThreads.

It is possible to specify the max number of concurrent virtual threads that can be spawned, to help limiting resource usage in applications, especially in case of load spikes, where an unlimited number of virtual threads may be spawned, compete for resources, and eventually bring the system down due to memory exhaustion.