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>
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
FieldsModifier and TypeFieldDescriptionprivate boolean
Whether or not this latch may create an object instanceobject timestamp pair allocated to this latch -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPair()
Returns ObjectTimestampPair allocated to this latchprivate boolean
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
Sets ObjectTimestampPair on this latch
-
Field Details
-
_pair
object timestamp pair allocated to this latch -
_mayCreate
private boolean _mayCreateWhether or not this latch may create an object instance
-
-
Constructor Details
-
Latch
private Latch()
-
-
Method Details
-
getPair
Returns ObjectTimestampPair allocated to this latch- Returns:
- ObjectTimestampPair allocated to this latch
-
setPair
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.
-