A Pool. that tracks the acquire/release/remove pool events.
The acquire/release/remove pool events are forwarded atomically to be handled
by a Tracker implementation, so that the pool event and the handling of
the event by the tracker are atomic.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | LockedPool.Factory<
the type of pooled objects F>A |
| private class | |
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| private final AutoLock | |
| private final LockedPool. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| lock | back to summary |
|---|---|
| private final AutoLock lock | |
| tracker | back to summary |
|---|---|
| private final LockedPool. | |
| LockedPool | back to summary |
|---|---|
| public LockedPool(Pool<P> pool) | |
| LockedPool | back to summary |
|---|---|
| public LockedPool(Pool<P> pool, LockedPool. | |
| acquire | back to summary |
|---|---|
| public Pool. Overrides org. Implements org. Doc from org. Acquires an entry from the pool. Only enabled entries will be returned from this method
and their | |
| acquire | back to summary |
|---|---|
| public Pool. Overrides org. Overrides default org. Doc from org. Acquires an entry from the pool, reserving and creating a new entry if necessary. | |
| getMaxSize | back to summary |
|---|---|
| public int getMaxSize() Overrides org. Implements org.
| |
| isTerminated | back to summary |
|---|---|
| public boolean isTerminated() Overrides org. Implements org.
| |
| reserve | back to summary |
|---|---|
| public Pool. Overrides org. Implements org. Doc from org. Creates a new disabled slot into the pool. The returned entry must ultimately have the | |
| size | back to summary |
|---|---|
| public int size() Overrides org. Implements org.
| |
| stream | back to summary |
|---|---|
| public Stream Overrides org. Implements org. | |
| terminate | back to summary |
|---|---|
| public Collection Overrides org. Implements org. Doc from org. Terminates this 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.
| |
A Pool. that wraps newly created
Pool instances with LockedPool.
| Modifier and Type | Method and Description |
|---|---|
| public default Pool | wrap(Pool<F>
the pool to wrap pool)Overrides default org. Wraps, if necessary, the given pool. |
| wrap | back to summary |
|---|---|
| public default Pool Overrides default org. Doc from org. Wraps, if necessary, the given pool. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | release()
Overrides org. Implements org. Releases this |
| public boolean | remove()
Overrides org. Implements org. Removes this |
| LockedEntry | back to summary |
|---|---|
| public LockedEntry(Pool. | |
| release | back to summary |
|---|---|
| public boolean release() Overrides org. Implements org. Doc from org. Releases this
| |
| remove | back to summary |
|---|---|
| public boolean remove() Overrides org. Implements org. Doc from org. Removes this
| |
A receiver of Pool events.
A simple implementations may just count acquire/release/remove
pool events via, respectively, acquired(Pool, Entry),
released(Pool, Entry) and removed(Pool, Entry),
and make sure that the count is 0 when
terminated(Pool, Collection) is called.
More advanced implementations may also obtain a stack trace at the time of the event to troubleshoot leaking of pooled entries.
| Modifier and Type | Method and Description |
|---|---|
| public default void | |
| public static < the type of pooled objects S> LockedPool. | |
| public default void | |
| public default void | |
| public default void | terminated(Pool<T>
the pool pool, Collection<Pool.the list of entries at termination entriesCallback method invoked when the |
| acquired | back to summary |
|---|---|
| public default void acquired(Pool<T> pool, Pool. Callback method invoked when an entry is
| |
| noTracker | back to summary |
|---|---|
public static <S> LockedPool.
| |
| released | back to summary |
|---|---|
| public default void released(Pool<T> pool, Pool. Callback method invoked when an entry is
| |
| removed | back to summary |
|---|---|
| public default void removed(Pool<T> pool, Pool. Callback method invoked when an entry is
| |
| terminated | back to summary |
|---|---|
| public default void terminated(Pool<T> pool, Collection<Pool. Callback method invoked when the
| |