Poolable managed by this pool.
Pool implementation that consists of
a queues of Poolable instances, the access to which is made faster with
clever use of ThreadLocals.
Object allocation always happens in a dedicated thread, off-loading the
cost of allocating the pooled objects. This leads to reduced deviation
in the times it takes claim method to complete, provided the pool is not
depleted.
BlazePool optimises for the case where the same threads need to claim and
release objects over and over again. On the other hand, if the releasing
thread tends to differ from the claiming thread, then the major optimisation
in BlazePool is defeated, and performance regresses to a slow-path that is
limited by contention on a blocking queue.
| Modifier and Type | Field and Description |
|---|---|
| private final AllocationController | |
| private final Expiration | |
| private final RefillPile | |
| pack-priv static final Exception | |
| private final LinkedTransferQueue | |
| private final MetricsRecorder | |
| private final RefillPile | |
| private final BSlot | poisonPill
A special slot used to signal that the pool has been shut down. |
| private volatile boolean | |
| private static final Exception | |
| private final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| pack-priv | BlazePool(PoolBuilder<T>
The pool configuration to use. builder, AllocationProcess factory)Construct a new BlazePool instance based on the given |
| Modifier and Type | Method and Description |
|---|---|
| public T | claim(Timeout
The timeout of the maximum permitted time-slice to wait for
an object to become available. A timeout with a value of zero or less
means that the call will do no waiting, preferring instead to return early
if no objects are available. timeout)Implements abstract stormpot. |
| private boolean | |
| public long | getAllocationCount()
Implements stormpot. |
| public double | getAllocationFailureLatencyPercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public double | getAllocationLatencyPercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public double | getDeallocationLatencyPercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public long | getFailedAllocationCount()
Implements stormpot. |
| public long | getLeakedObjectsCount()
Implements stormpot. |
| public ManagedPool | getManagedPool()
Implements abstract stormpot. ManagedPool instance that represents this pool.
|
| public double | getObjectLifetimePercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public double | getReallocationFailureLatencyPercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public double | getReallocationLatencyPercentile(double
The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0. percentile)Implements stormpot. |
| public int | getTargetSize()
Implements abstract stormpot. Implements stormpot. |
| public PoolTap | getThreadLocalTap()
Implements abstract stormpot. PoolTap that only support access by one thread at a time.
|
| private boolean | |
| private boolean | |
| private boolean | |
| public boolean | isShutDown()
Implements stormpot. |
| private boolean | |
| private void | |
| public void | setTargetSize(int
The new target size. size)Implements abstract stormpot. Implements stormpot. |
| public Completion | shutdown()
Implements abstract stormpot. Completion instance representing the shut down procedure.
|
| private T | |
| pack-priv T |
| allocator | back to summary |
|---|---|
| private final AllocationController<T> allocator | |
| deallocRule | back to summary |
|---|---|
| private final Expiration<? super T> deallocRule | |
| disregardPile | back to summary |
|---|---|
| private final RefillPile<T> disregardPile | |
| EXPLICIT_EXPIRE_POISON | back to summary |
|---|---|
| pack-priv static final Exception EXPLICIT_EXPIRE_POISON | |
| live | back to summary |
|---|---|
| private final LinkedTransferQueue<BSlot<T>> live | |
| metricsRecorder | back to summary |
|---|---|
| private final MetricsRecorder metricsRecorder | |
| newAllocations | back to summary |
|---|---|
| private final RefillPile<T> newAllocations | |
| poisonPill | back to summary |
|---|---|
| private final BSlot<T> poisonPill A special slot used to signal that the pool has been shut down. | |
| shutdown | back to summary |
|---|---|
| private volatile boolean shutdown | |
| SHUTDOWN_POISON | back to summary |
|---|---|
| private static final Exception SHUTDOWN_POISON | |
| tlr | back to summary |
|---|---|
| private final ThreadLocal<BSlotCache<T>> tlr | |
| BlazePool | back to summary |
|---|---|
| pack-priv BlazePool(PoolBuilder<T> builder, AllocationProcess factory) Construct a new BlazePool instance based on the given
| |
| claim | back to summary |
|---|---|
| public T claim(Timeout timeout) throws PoolException, InterruptedException Implements abstract stormpot. Doc from stormpot. Claim the exclusive rights until released, to an object in the pool.
Possibly waiting up to the specified amount of time, as given by the
provided
| |
| dealWithSlotPoison | back to summary |
|---|---|
| private boolean dealWithSlotPoison(BSlot<T> slot, BSlotCache<T> cache, boolean isTlr, Exception poison) | |
| getAllocationCount | back to summary |
|---|---|
| public long getAllocationCount() Implements stormpot. Doc from stormpot. Return the number of objects the pool has allocated since it was created.
| |
| getAllocationFailureLatencyPercentile | back to summary |
|---|---|
| public double getAllocationFailureLatencyPercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate latency value, in milliseconds, for failed allocation latencies within the given percentile/quantile of what has been recorded so far.
| |
| getAllocationLatencyPercentile | back to summary |
|---|---|
| public double getAllocationLatencyPercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate Poolable object allocation latency value, in milliseconds, of the given percentile/quantile of the values recorded so far.
| |
| getDeallocationLatencyPercentile | back to summary |
|---|---|
| public double getDeallocationLatencyPercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate latency value, in milliseconds, for deallocation latencies within the given percentile/quantile of what has been recorded so far.
| |
| getFailedAllocationCount | back to summary |
|---|---|
| public long getFailedAllocationCount() Implements stormpot. Doc from stormpot. Return the number of allocations that has failed, either because the allocator threw an exception or because it returned null, since the pool was created.
| |
| getLeakedObjectsCount | back to summary |
|---|---|
| public long getLeakedObjectsCount() Implements stormpot. Doc from stormpot. If the pool is capable of precise object leak detection, this method will return the number of object leaks that have been detected, and prevented, since the pool was created. If the pool does not support precise object leak detection, then this method returns -1. There are two kinds of leaks: One where the application forgets to release an object back to the pool, but keeps a strong reference to the object, and another where the application not only forgets to release the object, but also looses the reference to the object, making it eligible for garbage collection. The precise leak detector will only count leaks of the latter kind, where the leaked object has been garbage collected.
| |
| getManagedPool | back to summary |
|---|---|
| public ManagedPool getManagedPool() Implements abstract stormpot. Doc from stormpot. Get the
| |
| getObjectLifetimePercentile | back to summary |
|---|---|
| public double getObjectLifetimePercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate object lifetime, in milliseconds, for the given percentile/quantile.
| |
| getReallocationFailureLatencyPercentile | back to summary |
|---|---|
| public double getReallocationFailureLatencyPercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate latency value, in milliseconds, for failed reallocation latencies within the given percentile/quantile of what has been recorded so far.
| |
| getReallocationLatencyPercentile | back to summary |
|---|---|
| public double getReallocationLatencyPercentile(double percentile) Implements stormpot. Doc from stormpot. Get the approximate latency value, in milliseconds, for reallocation latencies within the given percentile/quantile of what has been recorded so far.
| |
| getTargetSize | back to summary |
|---|---|
| public int getTargetSize() Implements abstract stormpot. Implements stormpot. Doc from stormpot. Get the current target size of the pool.
| |
| getThreadLocalTap | back to summary |
|---|---|
| public PoolTap Implements abstract stormpot. Doc from stormpot. Get a | |
| handleCommonInvalidation | back to summary |
|---|---|
| private boolean handleCommonInvalidation(BSlot<T> slot, BSlotCache<T> cache, Throwable exception) | |
| handleUncommonInvalidation | back to summary |
|---|---|
| private boolean handleUncommonInvalidation(BSlot<T> slot, BSlotCache<T> cache, boolean isTlr) | |
| isInvalid | back to summary |
|---|---|
| private boolean isInvalid(BSlot<T> slot, BSlotCache<T> cache, boolean isTlr) | |
| isShutDown | back to summary |
|---|---|
| public boolean isShutDown() Implements stormpot. Doc from stormpot. Returns 'true' if the shut down process has been started on this pool, 'false' otherwise. This method does not reveal whether or not the shut down process has completed.
| |
| isUncommonlyInvalid | back to summary |
|---|---|
| private boolean isUncommonlyInvalid(BSlot<T> slot) | |
| kill | back to summary |
|---|---|
| private void kill(BSlot<T> slot, BSlotCache<T> cache) | |
| setTargetSize | back to summary |
|---|---|
| public void setTargetSize(int size) Implements abstract stormpot. Implements stormpot. Doc from stormpot. Set a new target size of the pool.
| |
| shutdown | back to summary |
|---|---|
| public Completion shutdown() Implements abstract stormpot. Doc from stormpot. Initiate the shut down process on this pool, and return a
| |
| slowClaim | back to summary |
|---|---|
| private T slowClaim(Timeout timeout, BSlotCache<T> cache) throws PoolException, InterruptedException | |
| tlrClaim | back to summary |
|---|---|
| pack-priv T tlrClaim(Timeout timeout, BSlotCache<T> cache) throws PoolException, InterruptedException | |