Package org.eclipse.jetty.util
Class Pool.Entry
java.lang.Object
org.eclipse.jetty.util.Pool.Entry
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
boolean
isClosed()
boolean
isIdle()
(package private) boolean
boolean
isInUse()
boolean
boolean
boolean
release()
Release the entry.boolean
remove()
Remove the entry.(package private) void
setUsageCount
(int usageCount) toString()
(package private) boolean
Try to acquire the entry if possible by incrementing both the usage count and the multiplex count.(package private) boolean
Try to release the entry if possible by decrementing the multiplexing count unless the entity is closed.(package private) boolean
Try to remove the entry by marking it as closed and decrementing the multiplexing counter.
-
Field Details
-
state
-
pooled
-
-
Constructor Details
-
Entry
Entry()
-
-
Method Details
-
setUsageCount
void setUsageCount(int usageCount) -
enable
Enable a reserved entryPool<T>.Entry
. An entry returned from thePool.reserve()
method must be enabled with this method, once and only once, before it is usable by the pool. The entry may be enabled and not acquired, in which case it is immediately available to be acquired, potentially by another thread; or it can be enabled and acquired atomically so that no other thread can acquire it, although the acquire may still fail if the pool has been closed.- Parameters:
pooled
- The pooled item for the entryacquire
- If true the entry is atomically enabled and acquired.- Returns:
- true If the entry was enabled.
- Throws:
IllegalStateException
- if the entry was already enabled
-
getPooled
-
release
public boolean release()Release the entry. This is equivalent to callingPool.release(Pool.Entry)
passing this entry.- Returns:
- true if released.
-
remove
public boolean remove()Remove the entry. This is equivalent to callingPool.remove(Pool.Entry)
passing this entry.- Returns:
- true if remove.
-
tryAcquire
boolean tryAcquire()Try to acquire the entry if possible by incrementing both the usage count and the multiplex count.- Returns:
- true if the usage count is <= maxUsageCount and the multiplex count is maxMultiplex and the entry is not closed, false otherwise.
-
tryRelease
boolean tryRelease()Try to release the entry if possible by decrementing the multiplexing count unless the entity is closed.- Returns:
- true if the entry was released,
false if
tryRemove()
should be called.
-
tryRemove
boolean tryRemove()Try to remove the entry by marking it as closed and decrementing the multiplexing counter. The multiplexing counter will never go below zero and if it reaches zero, the entry is considered removed.- Returns:
- true if the entry can be removed from the containing pool, false otherwise.
-
isClosed
public boolean isClosed() -
isReserved
public boolean isReserved() -
isIdle
public boolean isIdle() -
isInUse
public boolean isInUse() -
isOverUsed
public boolean isOverUsed() -
isIdleAndOverUsed
boolean isIdleAndOverUsed() -
getUsageCount
public int getUsageCount() -
toString
-