Package com.fasterxml.jackson.core.util
Class RecyclerPool.BoundedPoolBase<P extends RecyclerPool.WithPool<P>>
java.lang.Object
com.fasterxml.jackson.core.util.RecyclerPool.StatefulImplBase<P>
com.fasterxml.jackson.core.util.RecyclerPool.BoundedPoolBase<P>
- All Implemented Interfaces:
RecyclerPool<P>,Serializable
- Direct Known Subclasses:
JsonRecyclerPools.BoundedPool
- Enclosing interface:
RecyclerPool<P extends RecyclerPool.WithPool<P>>
public abstract static class RecyclerPool.BoundedPoolBase<P extends RecyclerPool.WithPool<P>>
extends RecyclerPool.StatefulImplBase<P>
RecyclerPool implementation that uses
a bounded queue (ArrayBlockingQueue for recycling instances.
This is "bounded" pool since it will never hold on to more
pooled instances than its size configuration:
the default size is DEFAULT_CAPACITY.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fasterxml.jackson.core.util.RecyclerPool
RecyclerPool.BoundedPoolBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.ConcurrentDequePoolBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.LockFreePoolBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.NonRecyclingPoolBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.StatefulImplBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.ThreadLocalPoolBase<P extends RecyclerPool.WithPool<P>>, RecyclerPool.WithPool<P extends RecyclerPool.WithPool<P>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault capacity which limits number of items that are ever retained for reuse.Fields inherited from class com.fasterxml.jackson.core.util.RecyclerPool.StatefulImplBase
SERIALIZATION_NON_SHARED, SERIALIZATION_SHARED -
Method Summary
Modifier and TypeMethodDescriptionMethod for sub-classes to implement for actual acquire logic; called byRecyclerPool.acquireAndLinkPooled().intcapacity()booleanclear()Optional method that may allow dropping of all pooled Objects; mostly useful for unbounded pool implementations that may retain significant memory and that may then be cleared regularly.intDiagnostic method for obtaining an estimate of number of pooled items this pool contains, available for recycling.voidreleasePooled(P pooled) Method that should be called when previously acquired (seeRecyclerPool.acquireAndLinkPooled()) pooled value that is no longer needed; this lets pool to take ownership for possible reuse.Methods inherited from class com.fasterxml.jackson.core.util.RecyclerPool.StatefulImplBase
createPooledMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.fasterxml.jackson.core.util.RecyclerPool
acquireAndLinkPooled
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYDefault capacity which limits number of items that are ever retained for reuse.- See Also:
-
-
Method Details
-
acquirePooled
Description copied from interface:RecyclerPoolMethod for sub-classes to implement for actual acquire logic; called byRecyclerPool.acquireAndLinkPooled().- Returns:
- Instance acquired (pooled or just constructed)
-
releasePooled
Description copied from interface:RecyclerPoolMethod that should be called when previously acquired (seeRecyclerPool.acquireAndLinkPooled()) pooled value that is no longer needed; this lets pool to take ownership for possible reuse.- Parameters:
pooled- Pooled instance to release back to pool
-
pooledCount
public int pooledCount()Description copied from interface:RecyclerPoolDiagnostic method for obtaining an estimate of number of pooled items this pool contains, available for recycling. Note that in addition to this information possibly not being available (denoted by return value of-1) even when available this may be just an approximation.Default method implementation simply returns
-1and is meant to be overridden by concrete sub-classes.- Returns:
- Number of pooled entries available from this pool, if available;
-1if not.
-
clear
public boolean clear()Description copied from interface:RecyclerPoolOptional method that may allow dropping of all pooled Objects; mostly useful for unbounded pool implementations that may retain significant memory and that may then be cleared regularly.- Returns:
trueIf pool supports operation and dropped all pooled Objects;falseotherwise.
-
capacity
public int capacity()
-