Package org.apache.commons.pool.impl
Class GenericObjectPool.Latch<T>
- java.lang.Object
-
- org.apache.commons.pool.impl.GenericObjectPool.Latch<T>
-
- Enclosing class:
- GenericObjectPool<T>
private static final class GenericObjectPool.Latch<T> extends java.lang.Object
Latch used to control allocation order of objects to threads to ensure fairness. That is, objects are allocated to threads in the order that threads request objects.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_mayCreate
Whether or not this latch may create an object instanceprivate GenericKeyedObjectPool.ObjectTimestampPair<T>
_pair
object timestamp pair allocated to this latch
-
Constructor Summary
Constructors Modifier Constructor Description private
Latch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private GenericKeyedObjectPool.ObjectTimestampPair<T>
getPair()
Returns ObjectTimestampPair allocated to this latchprivate boolean
mayCreate()
Whether or not this latch may create an object instanceprivate void
reset()
Reset the latch data.private void
setMayCreate(boolean mayCreate)
Sets the mayCreate propertyprivate void
setPair(GenericKeyedObjectPool.ObjectTimestampPair<T> pair)
Sets ObjectTimestampPair on this latch
-
-
-
Field Detail
-
_pair
private GenericKeyedObjectPool.ObjectTimestampPair<T> _pair
object timestamp pair allocated to this latch
-
_mayCreate
private boolean _mayCreate
Whether or not this latch may create an object instance
-
-
Method Detail
-
getPair
private GenericKeyedObjectPool.ObjectTimestampPair<T> getPair()
Returns ObjectTimestampPair allocated to this latch- Returns:
- ObjectTimestampPair allocated to this latch
-
setPair
private void setPair(GenericKeyedObjectPool.ObjectTimestampPair<T> pair)
Sets ObjectTimestampPair on this latch- Parameters:
pair
- ObjectTimestampPair allocated to this latch
-
mayCreate
private boolean mayCreate()
Whether or not this latch may create an object instance- Returns:
- true if this latch has an instance creation permit
-
setMayCreate
private void setMayCreate(boolean mayCreate)
Sets the mayCreate property- Parameters:
mayCreate
- new value for mayCreate
-
reset
private void reset()
Reset the latch data. Used when an allocation fails and the latch needs to be re-added to the queue.
-
-