Class Pool<T>
- java.lang.Object
 - 
- org.eclipse.jetty.util.Pool<T>
 
 
- 
- Type Parameters:
 T- the type of the pooled objects
- All Implemented Interfaces:
 java.lang.AutoCloseable,Dumpable
@ManagedObject @Deprecated(since="2021-05-27") public class Pool<T> extends java.lang.Object implements java.lang.AutoCloseable, Dumpable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.A pool of objects, with optional support for multiplexing, max usage count and several optimized strategies plus an optional
ThreadLocalcache of the last release entry.When the method
close()is called, allCloseables object pooled by the pool are also closed. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description classPool.EntryDeprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.static classPool.StrategyTypeDeprecated.The type of the strategy to use for the pool.- 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer 
 - 
 
- 
Constructor Summary
Constructors Constructor Description Pool(Pool.StrategyType strategyType, int maxEntries)Deprecated.Construct a Pool with a specified lookup strategy and noThreadLocalcache.Pool(Pool.StrategyType strategyType, int maxEntries, boolean cache)Deprecated.Construct a Pool with the specified thread-local cache size and an optionalThreadLocalcache. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Pool.Entryacquire()Deprecated.Acquires an entry from the pool.Pool.Entryacquire(java.util.function.Function<Pool.Entry,T> creator)Deprecated.Acquires an entry from the pool, reserving and creating a new entry if necessary.Pool.EntryacquireAt(int idx)Deprecated.No longer supported.voidclose()Deprecated.voiddump(java.lang.Appendable out, java.lang.String indent)Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.intgetClosedCount()Deprecated.intgetIdleCount()Deprecated.intgetInUseCount()Deprecated.intgetMaxEntries()Deprecated.intgetMaxMultiplex()Deprecated.Multiplex functionalities will be removedintgetMaxUsageCount()Deprecated.MaxUsage functionalities will be removedintgetReservedCount()Deprecated.booleanisClosed()Deprecated.booleanrelease(Pool.Entry entry)Deprecated.Releases anacquiredentry to the pool.booleanremove(Pool.Entry entry)Deprecated.Removes an entry from the pool.Pool.Entryreserve()Deprecated.Creates a new disabled slot into the pool.Pool.Entryreserve(int allotment)Deprecated.Usereserve()insteadvoidsetMaxMultiplex(int maxMultiplex)Deprecated.Multiplex functionalities will be removedvoidsetMaxUsageCount(int maxUsageCount)Deprecated.MaxUsage functionalities will be removedintsize()Deprecated.java.lang.StringtoString()Deprecated.java.util.Collection<Pool.Entry>values()Deprecated. 
 - 
 
- 
- 
Constructor Detail
- 
Pool
public Pool(Pool.StrategyType strategyType, int maxEntries)
Deprecated.Construct a Pool with a specified lookup strategy and noThreadLocalcache.- Parameters:
 strategyType- The strategy to used for looking up entries.maxEntries- the maximum amount of entries that the pool will accept.
 
- 
Pool
public Pool(Pool.StrategyType strategyType, int maxEntries, boolean cache)
Deprecated.Construct a Pool with the specified thread-local cache size and an optionalThreadLocalcache.- Parameters:
 strategyType- The strategy to used for looking up entries.maxEntries- the maximum amount of entries that the pool will accept.cache- True if aThreadLocalcache should be used to try the most recently released entry.
 
 - 
 
- 
Method Detail
- 
getReservedCount
@ManagedAttribute("The number of reserved entries") public int getReservedCount()
Deprecated.- Returns:
 - the number of reserved entries
 
 
- 
getIdleCount
@ManagedAttribute("The number of idle entries") public int getIdleCount()
Deprecated.- Returns:
 - the number of idle entries
 
 
- 
getInUseCount
@ManagedAttribute("The number of in-use entries") public int getInUseCount()
Deprecated.- Returns:
 - the number of in-use entries
 
 
- 
getClosedCount
@ManagedAttribute("The number of closed entries") public int getClosedCount()
Deprecated.- Returns:
 - the number of closed entries
 
 
- 
getMaxEntries
@ManagedAttribute("The maximum number of entries") public int getMaxEntries()
Deprecated.- Returns:
 - the maximum number of entries
 
 
- 
getMaxMultiplex
@ManagedAttribute("The default maximum multiplex count of entries") @Deprecated public int getMaxMultiplex()
Deprecated.Multiplex functionalities will be removed- Returns:
 - the default maximum multiplex count of entries
 
 
- 
setMaxMultiplex
@Deprecated public final void setMaxMultiplex(int maxMultiplex)
Deprecated.Multiplex functionalities will be removedSets the default maximum multiplex count for the Pool's entries.
- Parameters:
 maxMultiplex- the default maximum multiplex count of entries
 
- 
getMaxUsageCount
@ManagedAttribute("The default maximum usage count of entries") @Deprecated public int getMaxUsageCount()
Deprecated.MaxUsage functionalities will be removedReturns the maximum number of times the entries of the pool can be acquired.
- Returns:
 - the default maximum usage count of entries
 
 
- 
setMaxUsageCount
@Deprecated public final void setMaxUsageCount(int maxUsageCount)
Deprecated.MaxUsage functionalities will be removedSets the maximum usage count for the Pool's entries.
All existing idle entries that have a usage count larger than this new value are removed from the Pool and closed.
- Parameters:
 maxUsageCount- the default maximum usage count of entries
 
- 
reserve
@Deprecated public Pool.Entry reserve(int allotment)
Deprecated.Usereserve()insteadCreates 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()orremove(Pool.Entry).- Parameters:
 allotment- the desired allotment, where each entry handles an allotment of maxMultiplex, or a negative number to always trigger the reservation of a new entry.- Returns:
 - a disabled entry that is contained in the pool,
 or null if the pool is closed or if the pool already contains
 
getMaxEntries()entries, or the allotment has already been reserved 
 
- 
reserve
public Pool.Entry reserve()
Deprecated.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()orremove(Pool.Entry).- Returns:
 - a disabled entry that is contained in the pool,
 or null if the pool is closed or if the pool already contains
 
getMaxEntries()entries 
 
- 
acquireAt
@Deprecated public Pool.Entry acquireAt(int idx)
Deprecated.No longer supported. Instead use aPool.StrategyTypeto configure the pool.Acquires the entry from the pool at the specified index.
This method bypasses the thread-local cache mechanism.
- Parameters:
 idx- the index of the entry to acquire.- Returns:
 - the specified entry or null if there is none at the specified index or if it is not available.
 
 
- 
acquire
public Pool.Entry acquire()
Deprecated.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.- Returns:
 - an entry from the pool or null if none is available.
 
 
- 
acquire
public Pool.Entry acquire(java.util.function.Function<Pool.Entry,T> creator)
Deprecated.Acquires an entry from the pool, reserving and creating a new entry if necessary.
- Parameters:
 creator- a function to create the pooled value for a reserved entry.- Returns:
 - an entry from the pool or null if none is available.
 
 
- 
release
public boolean release(Pool.Entry entry)
Deprecated.Releases an
acquiredentry to the pool.Entries that are acquired from the pool but never released will result in a memory leak.
- Parameters:
 entry- the value to return to the pool- Returns:
 - true if the entry was released and could be acquired again,
 false if the entry should be removed by calling 
remove(Pool.Entry)and the object contained by the entry should be disposed. 
 
- 
remove
public boolean remove(Pool.Entry entry)
Deprecated.Removes an entry from the pool.
- Parameters:
 entry- the value to remove- Returns:
 - true if the entry was removed, false otherwise
 
 
- 
isClosed
public boolean isClosed()
Deprecated. 
- 
close
public void close()
Deprecated.- Specified by:
 closein interfacejava.lang.AutoCloseable
 
- 
size
public int size()
Deprecated. 
- 
values
public java.util.Collection<Pool.Entry> values()
Deprecated. 
- 
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOExceptionDeprecated.Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped. 
- 
toString
public java.lang.String toString()
Deprecated.- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -