Package org.eclipse.jetty.util
Interface LockedPool.Tracker<T>
- Type Parameters:
T
- the type of pooled objects
- Enclosing class:
- LockedPool<P>
public static interface LockedPool.Tracker<T>
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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
acquired
(Pool<T> pool, Pool.Entry<T> entry) Callback method invoked when an entry isacquired
.static <S> LockedPool.Tracker<S>
default void
released
(Pool<T> pool, Pool.Entry<T> entry) Callback method invoked when an entry isreleased
.default void
removed
(Pool<T> pool, Pool.Entry<T> entry) Callback method invoked when an entry isremoved
.default void
terminated
(Pool<T> pool, Collection<Pool.Entry<T>> entries) Callback method invoked when thePool
isterminated
.
-
Method Details
-
noTracker
- Type Parameters:
S
- the type of pooled objects- Returns:
- a no-op implementation of
Tracker
-
acquired
Callback method invoked when an entry is
acquired
.- Parameters:
pool
- the poolentry
- the acquired entry
-
released
Callback method invoked when an entry is
released
.- Parameters:
pool
- the poolentry
- the released entry
-
removed
Callback method invoked when an entry is
removed
.- Parameters:
pool
- the poolentry
- the removed entry
-
terminated
Callback method invoked when the
Pool
isterminated
.- Parameters:
pool
- the poolentries
- the list of entries at termination
-