Class ThreadIdPool<E>

java.lang.Object
org.eclipse.jetty.util.thread.ThreadIdPool<E>
All Implemented Interfaces:
Dumpable

public class ThreadIdPool<E> extends Object implements Dumpable
A fixed sized pool of items that uses ThreadId to avoid contention. This class can be used, instead of a ThreadLocal, when pooling items that are expensive to create, but only used briefly in the scope of a single thread. It is safe to use with VirtualThreads, as unlike a ThreadLocal pool, the number of items is limited.

This is a light-weight version of ConcurrentPool that is best used when items do not reserve an index in the pool even when acquired.

See Also: