Top Description Inners Fields Constructors Methods
reactor.pool

public Class SimpleDequePool<POOLABLE>

extends AbstractPool<POOLABLE>
Class Inheritance
Imports
java.time.Duration, java.util.Deque, .Iterator, .Objects, .Queue, java.util.concurrent.ConcurrentLinkedDeque, .TimeUnit, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, .AtomicReference, .AtomicReferenceFieldUpdater, java.util.function.BiPredicate, .Function, org.reactivestreams.Publisher, .Subscription, reactor.core.CoreSubscriber, .Disposable, .Disposables, .Exceptions, .Scannable, reactor.core.publisher.Flux, .Mono, .Operators, reactor.core.scheduler.Scheduler, .Schedulers, reactor.util.Loggers, reactor.util.annotation.Nullable

The SimpleDequePool is based on Deque for idle resources and pending Pool#acquire() Monos, allowing both to be ordered either LIFO or FIFO. It uses non-blocking drain loops to deliver resources to borrowers, which means that a resource could be handed off on any of the following threads: For a more deterministic approach, the PoolBuilder#acquisitionScheduler(Scheduler) property of the builder can be used.
Author
Simon Baslé

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv volatile int
private static final AtomicIntegerFieldUpdater<SimpleDequePool<POOLABLE>>
pack-priv Disposable
protected static final AtomicReferenceFieldUpdater<SimpleDequePool<POOLABLE>, Deque<E>>
private static final AtomicIntegerFieldUpdater<SimpleDequePool<POOLABLE>>
pack-priv final boolean
pack-priv volatile Deque<SimpleDequePool.QueuePooledRef<POOLABLE>>
pack-priv volatile int
pack-priv volatile ConcurrentLinkedDeque<AbstractPool.Borrower<POOLABLE>>
private static final AtomicReferenceFieldUpdater<SimpleDequePool<POOLABLE>, ConcurrentLinkedDeque<E>>
private static final AtomicIntegerFieldUpdater<SimpleDequePool<POOLABLE>>
pack-priv volatile int
private static final ConcurrentLinkedDeque<E>
pack-priv volatile int
private static final AtomicIntegerFieldUpdater<SimpleDequePool<POOLABLE>>
Inherited from reactor.pool.AbstractPool:
clocklastInteractionTimestamploggermetricsRecorderpoolConfig

Constructor Summary

AccessConstructor and Description
pack-priv
SimpleDequePool(PoolConfig<POOLABLE> poolConfig)

Method Summary

Modifier and TypeMethod and Description
public Mono<PooledRef<POOLABLE>>
acquire()

Implements reactor.pool.Pool.acquire.

Manually acquire a POOLABLE from the pool upon subscription and become responsible for its release.
public Mono<PooledRef<POOLABLE>>
acquire(Duration timeout)

Implements reactor.pool.Pool.acquire.

Manually acquire a POOLABLE from the pool upon subscription and become responsible for its release.
public int
acquiredSize()

Overrides reactor.pool.AbstractPool.acquiredSize.

Implements reactor.pool.InstrumentedPool.PoolMetrics.acquiredSize.

Measure the current number of resources that have been successfully acquired and are in active use, outside of the control of the pool until they're released back to it.
private Mono<POOLABLE>
pack-priv void
pack-priv SimpleDequePool.QueuePooledRef<POOLABLE>
createSlot(POOLABLE element)

pack-priv void
public Mono<Void>
disposeLater()

Implements reactor.pool.Pool.disposeLater.

Returns a Mono that represents a lazy asynchronous shutdown of this Pool.
pack-priv void
doAcquire(AbstractPool.Borrower<POOLABLE> borrower)

Implements abstract reactor.pool.AbstractPool.doAcquire.

Note to implementors: stop the Borrower countdown by calling Borrower#stopPendingCountdown(boolean) as soon as it is known that a resource is available or is in the process of being allocated.
pack-priv void
private void
pack-priv boolean
elementOffer(POOLABLE element)

Implements abstract reactor.pool.AbstractPool.elementOffer.

pack-priv void
public int
idleSize()

Implements abstract reactor.pool.AbstractPool.idleSize.

Implements reactor.pool.InstrumentedPool.PoolMetrics.idleSize.

Measure the current number of idle resources in the Pool.
pack-priv void
public boolean
isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.
pack-priv final void
public int
pendingAcquireSize()

Implements reactor.pool.InstrumentedPool.PoolMetrics.pendingAcquireSize.

Measure the current number of "pending" acquire Monos in the Pool.
pack-priv void
pendingOffer(AbstractPool.Borrower<POOLABLE>
a new reactor.pool.AbstractPool.Borrower to add to the queue and later either serve or consider pending
pending
)

pack-priv AbstractPool.Borrower<POOLABLE>

Returns:

the next reactor.pool.AbstractPool.Borrower to serve
pendingPoll
(Deque<AbstractPool.Borrower<POOLABLE>> borrowers)

pack-priv SimpleDequePool.QueuePooledRef<POOLABLE>
pack-priv void
public Mono<Integer>
warmup()

Implements reactor.pool.Pool.warmup.

Warms up the Pool, if needed.
pack-priv Mono<Void>
warmupMono(int index, int max, long startWarmupIteration, Mono<POOLABLE> allocator)

Inherited from reactor.pool.AbstractPool:
allocatedSizeconfigdestroyPoolablegetMaxAllocatedSizegetMaxPendingAcquireSizeisInactiveForMoreThanmetricsrecordInteractionTimestampsecondsSinceLastInteraction