ObjectPool implemented using ConcurrentLinkedQueue.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final int | |
| private final Queue | |
| private final ObjectPool. | |
| private final ObjectPool. |
| Access | Constructor and Description |
|---|---|
| public | ConcurrentQueueObjectPool(ObjectPool.
The supplier. supplier,The sanitizer. sanitizer,The maximum capacity. maxCapacity)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public ObjectPool. | take()
Implements org. Takes an exclusive lease of an object from the pool. |
| count | back to summary |
|---|---|
| private final AtomicInteger count | |
| maxCapacity | back to summary |
|---|---|
| private final int maxCapacity | |
| queue | back to summary |
|---|---|
| private final Queue<O> queue | |
| sanitizer | back to summary |
|---|---|
| private final ObjectPool. | |
| supplier | back to summary |
|---|---|
| private final ObjectPool. | |
| ConcurrentQueueObjectPool | back to summary |
|---|---|
| public ConcurrentQueueObjectPool(ObjectPool. Constructs a
| |
| take | back to summary |
|---|---|
| public ObjectPool. Implements org. Doc from org. Takes an exclusive lease of an object from the pool. If no existing object is available from the pool, a new one may be provided.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | close()
Implements org. Terminates the validity of this lease. |
| public void | discard()
Implements org. Marks the leased object as discarded, potentially preventing it from being reused in the object pool. |
| public O | get()
Implements org. Returns the leased object, potentially |
| obj | back to summary |
|---|---|
| private @Nullable O obj | |
| LeaseImpl | back to summary |
|---|---|
| public LeaseImpl(O obj) | |
| close | back to summary |
|---|---|
| public synchronized void close() Implements org. Doc from org. Terminates the validity of this lease. Unless discarded via
| |
| discard | back to summary |
|---|---|
| public void discard() Implements org. Doc from org. Marks the leased object as discarded, potentially preventing it from being reused in the object pool.
| |
| get | back to summary |
|---|---|
| public O get() Implements org. Doc from org. Returns the leased object, potentially
| |