Package com.fasterxml.jackson.core.util
Class RecyclerPool.NonRecyclingPoolBase<P extends RecyclerPool.WithPool<P>>
java.lang.Object
com.fasterxml.jackson.core.util.RecyclerPool.NonRecyclingPoolBase<P>
- All Implemented Interfaces:
RecyclerPool<P>
,Serializable
- Direct Known Subclasses:
JsonRecyclerPools.NonRecyclingPool
- Enclosing interface:
RecyclerPool<P extends RecyclerPool.WithPool<P>>
public abstract static class RecyclerPool.NonRecyclingPoolBase<P extends RecyclerPool.WithPool<P>>
extends Object
implements RecyclerPool<P>
RecyclerPool
implementation that does not use
any pool but simply creates new instances when necessary.- 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>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethod called to acquire a Pooled value from this pool AND make sure it is linked back to thisRecyclerPool
as necessary for it to be released (seeRecyclerPool.releasePooled(P)
) later after usage ends.abstract P
Method for sub-classes to implement for actual acquire logic; called byRecyclerPool.acquireAndLinkPooled()
.boolean
clear()
Although no pooling occurs, we consider clearing to succeed, so returns alwaystrue
.int
Diagnostic method for obtaining an estimate of number of pooled items this pool contains, available for recycling.void
releasePooled
(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.
-
Constructor Details
-
NonRecyclingPoolBase
public NonRecyclingPoolBase()
-
-
Method Details
-
acquireAndLinkPooled
Description copied from interface:RecyclerPool
Method called to acquire a Pooled value from this pool AND make sure it is linked back to thisRecyclerPool
as necessary for it to be released (seeRecyclerPool.releasePooled(P)
) later after usage ends. Actual acquisition is done by a call toRecyclerPool.acquirePooled()
.Default implementation calls
RecyclerPool.acquirePooled()
followed by a call toRecyclerPool.WithPool.withPool(com.fasterxml.jackson.core.util.RecyclerPool<P>)
.- Specified by:
acquireAndLinkPooled
in interfaceRecyclerPool<P extends RecyclerPool.WithPool<P>>
- Returns:
- Pooled instance for caller to use; caller expected
to call
RecyclerPool.releasePooled(P)
after it is done using instance.
-
acquirePooled
Description copied from interface:RecyclerPool
Method for sub-classes to implement for actual acquire logic; called byRecyclerPool.acquireAndLinkPooled()
.- Specified by:
acquirePooled
in interfaceRecyclerPool<P extends RecyclerPool.WithPool<P>>
- Returns:
- Instance acquired (pooled or just constructed)
-
releasePooled
Description copied from interface:RecyclerPool
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.- Specified by:
releasePooled
in interfaceRecyclerPool<P extends RecyclerPool.WithPool<P>>
- Parameters:
pooled
- Pooled instance to release back to pool
-
pooledCount
public int pooledCount()Description copied from interface:RecyclerPool
Diagnostic 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
-1
and is meant to be overridden by concrete sub-classes.- Specified by:
pooledCount
in interfaceRecyclerPool<P extends RecyclerPool.WithPool<P>>
- Returns:
- Number of pooled entries available from this pool, if available;
-1
if not.
-
clear
public boolean clear()Although no pooling occurs, we consider clearing to succeed, so returns alwaystrue
.- Specified by:
clear
in interfaceRecyclerPool<P extends RecyclerPool.WithPool<P>>
- Returns:
- Always returns
true
-