Class LockedPool<P>
- Type Parameters:
P
- the type of the pooled objects
- All Implemented Interfaces:
Pool<P>
A Pool.Wrapper
that tracks the acquire/release/remove pool events.
The acquire/release/remove pool events are forwarded atomically to be handled
by a LockedPool.Tracker
implementation, so that the pool event and the handling of
the event by the tracker are atomic.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Pool
Pool.Entry<E>, Pool.Wrapper<W>
-
Constructor Summary
ConstructorDescriptionLockedPool
(Pool<P> pool) LockedPool
(Pool<P> pool, LockedPool.Tracker<P> tracker) -
Method Summary
Modifier and TypeMethodDescriptionacquire()
Acquires an entry from the pool.acquire
(Function<Pool.Entry<P>, P> creator) Acquires an entry from the pool, reserving and creating a new entry if necessary.int
boolean
reserve()
Creates a new disabled slot into the pool.int
size()
stream()
Terminates thisPool
.Methods inherited from class org.eclipse.jetty.util.Pool.Wrapper
getIdleCount, getInUseCount, getReservedCount, getTerminatedCount, getWrapped
-
Constructor Details
-
LockedPool
-
LockedPool
-
-
Method Details
-
reserve
Description copied from interface:Pool
Creates a new disabled slot into the pool.
The returned entry must ultimately have the
Pool.Entry.enable(Object, boolean)
method called or be removed viaPool.Entry.remove()
. -
acquire
Description copied from interface:Pool
Acquires an entry from the pool.
Only enabled entries will be returned from this method and their
Pool.Entry.enable(Object, boolean)
method must not be called. -
acquire
Description copied from interface:Pool
Acquires an entry from the pool, reserving and creating a new entry if necessary.
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfacePool<P>
- Overrides:
isTerminated
in classPool.Wrapper<P>
- Returns:
- whether this
Pool
has been terminated - See Also:
-
terminate
Description copied from interface:Pool
Terminates this
Pool
.All the entries are marked as terminated and cannot be acquired nor released, but only removed.
The returned list of all entries may be iterated to perform additional operations on the pooled objects.
The pool cannot be used anymore after it is terminated.
-
size
public int size() -
getMaxSize
public int getMaxSize()- Specified by:
getMaxSize
in interfacePool<P>
- Overrides:
getMaxSize
in classPool.Wrapper<P>
- Returns:
- the maximum number of entries in this
Pool
-
stream
-