Package org.eclipse.jetty.util
Class Pool.MultiEntry
- java.lang.Object
-
- org.eclipse.jetty.util.Pool.Entry
-
- org.eclipse.jetty.util.Pool.MultiEntry
-
class Pool.MultiEntry extends Pool.Entry
A Pool entry that holds metadata and a pooled object, that can be acquired concurrently multiple times, and can be acquired/released multiple times.
-
-
Field Summary
Fields Modifier and Type Field Description private AtomicBiIntegerstate
-
Constructor Summary
Constructors Constructor Description MultiEntry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intgetUsageCount()booleanisClosed()booleanisIdle()(package private) booleanisIdleAndOverUsed()booleanisInUse()booleanisOverUsed()booleanisReserved()(package private) voidsetUsageCount(int usageCount)java.lang.StringtoString()(package private) booleantryAcquire()Tries to acquire the entry if possible by incrementing both the usage count and the multiplex count.protected booleantryEnable(boolean acquire)Tries to enable, and possible also acquire, this Entry.(package private) booleantryRelease()Tries to release the entry if possible by decrementing the multiplex count unless the entity is closed.(package private) booleantryRemove()Tries to remove the entry by marking it as closed and decrementing the multiplex counter.-
Methods inherited from class org.eclipse.jetty.util.Pool.Entry
enable, getPooled, release, remove
-
-
-
-
Field Detail
-
state
private final AtomicBiInteger state
-
-
Method Detail
-
setUsageCount
void setUsageCount(int usageCount)
- Overrides:
setUsageCountin classPool.Entry
-
tryEnable
protected boolean tryEnable(boolean acquire)
Description copied from class:Pool.EntryTries to enable, and possible also acquire, this Entry.
- Specified by:
tryEnablein classPool.Entry- Parameters:
acquire- whether to also acquire this Entry- Returns:
- whether this Entry was enabled
-
tryAcquire
boolean tryAcquire()
Tries to acquire the entry if possible by incrementing both the usage count and the multiplex count.
- Specified by:
tryAcquirein classPool.Entry- Returns:
- true if the usage count is less than
Pool.getMaxUsageCount()and the multiplex count is less thanPool.getMaxMultiplex(Object)and the entry is not closed, false otherwise.
-
tryRelease
boolean tryRelease()
Tries to release the entry if possible by decrementing the multiplex count unless the entity is closed.
- Specified by:
tryReleasein classPool.Entry- Returns:
- true if the entry was released,
false if
tryRemove()should be called.
-
tryRemove
boolean tryRemove()
Tries to remove the entry by marking it as closed and decrementing the multiplex counter.
The multiplex counter will never go below zero and if it reaches zero, the entry is considered removed.
- Specified by:
tryRemovein classPool.Entry- Returns:
- true if the entry can be removed from the containing pool, false otherwise.
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin classPool.Entry- Returns:
- whether this Entry is closed
-
isReserved
public boolean isReserved()
- Specified by:
isReservedin classPool.Entry- Returns:
- whether this Entry is reserved
-
isIdle
public boolean isIdle()
- Specified by:
isIdlein classPool.Entry- Returns:
- whether this Entry is idle
-
isInUse
public boolean isInUse()
- Specified by:
isInUsein classPool.Entry- Returns:
- whether this entry is in use.
-
isOverUsed
public boolean isOverUsed()
- Overrides:
isOverUsedin classPool.Entry- Returns:
- whether this entry has been used beyond
Pool.getMaxUsageCount()
-
isIdleAndOverUsed
boolean isIdleAndOverUsed()
- Overrides:
isIdleAndOverUsedin classPool.Entry
-
getUsageCount
int getUsageCount()
- Overrides:
getUsageCountin classPool.Entry
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-