R - the type of the resourcestatic class PoolMap.ThreadLocalPool<R> extends ThreadLocal<R> implements PoolMap.Pool<R>
ThreadLocalPool represents a PoolMap.Pool that
builds on the ThreadLocal class. It essentially binds the resource
to the thread from which it is accessed.
Note that the size of the pool is essentially bounded by the number of threads that add resources to this pool.
| Modifier and Type | Field and Description |
|---|---|
private static Map<PoolMap.ThreadLocalPool<?>,AtomicInteger> |
poolSizes |
| Constructor and Description |
|---|
ThreadLocalPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
R |
put(R resource) |
void |
remove() |
boolean |
remove(R resource) |
int |
size() |
Collection<R> |
values() |
get, initialValue, set, withInitialclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetprivate static final Map<PoolMap.ThreadLocalPool<?>,AtomicInteger> poolSizes
public ThreadLocalPool()
public void remove()
remove in class ThreadLocal<R>public int size()
size in interface PoolMap.Pool<R>public boolean remove(R resource)
remove in interface PoolMap.Pool<R>public void clear()
clear in interface PoolMap.Pool<R>public Collection<R> values()
values in interface PoolMap.Pool<R>Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.