Package com.fasterxml.jackson.core.util

# Class RecyclerPool.ThreadLocalPoolBase<P extends RecyclerPool.WithPool<P>>

java.lang.Object
com.fasterxml.jackson.core.util.RecyclerPool.ThreadLocalPoolBase<P>

All Implemented Interfaces:
  `RecyclerPool<P>`, `Serializable`

Direct Known Subclasses:
  `JsonRecyclerPools.ThreadLocalPool`

Enclosing interface:
  RecyclerPool<P extends RecyclerPool.WithPool<P>>

public abstract static class RecyclerPool.ThreadLocalPoolBase<P extends RecyclerPool.WithPool<P>> extends Object implements RecyclerPool<P>
Default `RecyclerPool` implementation that uses `ThreadLocal` for recycling instances. Instances are stored using `SoftReference`s so that they may be Garbage Collected as needed by JVM.

Note that this implementation may not work well on platforms where `SoftReference`s are not well supported (like Android), or on platforms where `Thread`s are not long-living or reused (like Project Loom).

See Also:
  - Serialized Form

## 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
Modifier
Constructor
Description
`protected`
`ThreadLocalPoolBase()`

## Method Summary

Modifier and Type
Method
Description
`P`
`acquireAndLinkPooled()`
Method called to acquire a Pooled value from this pool AND make sure it is linked back to this `RecyclerPool` as necessary for it to be released (see `RecyclerPool.releasePooled(P)`) later after usage ends.
`abstract P`
`acquirePooled()`
Method for sub-classes to implement for actual acquire logic; called by `RecyclerPool.acquireAndLinkPooled()`.
`void`
`releasePooled(P pooled)`
Method that should be called when previously acquired (see `RecyclerPool.acquireAndLinkPooled()`) pooled value that is no longer needed; this lets pool to take ownership for possible reuse.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ThreadLocalPoolBase

protected ThreadLocalPoolBase()

## Method Details

### acquireAndLinkPooled

public P acquireAndLinkPooled()
Description copied from interface: `RecyclerPool`
Method called to acquire a Pooled value from this pool AND make sure it is linked back to this `RecyclerPool` as necessary for it to be released (see `RecyclerPool.releasePooled(P)`) later after usage ends. Actual acquisition is done by a call to `RecyclerPool.acquirePooled()`.

Default implementation calls `RecyclerPool.acquirePooled()` followed by a call to `RecyclerPool.WithPool.withPool(com.fasterxml.jackson.core.util.RecyclerPool<P>)`.

Specified by:
  `acquireAndLinkPooled` in interface `RecyclerPool<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

public abstract P acquirePooled()
Description copied from interface: `RecyclerPool`
Method for sub-classes to implement for actual acquire logic; called by `RecyclerPool.acquireAndLinkPooled()`.

Specified by:
  `acquirePooled` in interface `RecyclerPool<P extends RecyclerPool.WithPool<P>>`
Returns:
  Instance acquired (pooled or just constructed)

### releasePooled

public void releasePooled(P pooled)
Description copied from interface: `RecyclerPool`
Method that should be called when previously acquired (see `RecyclerPool.acquireAndLinkPooled()`) pooled value that is no longer needed; this lets pool to take ownership for possible reuse.

Specified by:
  `releasePooled` in interface `RecyclerPool<P extends RecyclerPool.WithPool<P>>`
Parameters:
  `pooled` - Pooled instance to release back to pool