Package org.apache.hadoop.hbase.util
Class PoolMap.ThreadLocalPool<R>
java.lang.Object
org.apache.hadoop.hbase.util.PoolMap.ThreadLocalPool<R>
- Type Parameters:
R- the type of the resource
- All Implemented Interfaces:
PoolMap.Pool<R>
The
ThreadLocalPool represents a PoolMap.Pool that works similarly to
ThreadLocal class. It essentially binds the resource to the thread from which it is
accessed. It doesn't remove resources when a thread exits, those resources must be closed
manually.
Note that the size of the pool is essentially bounded by the number of threads that add resources to this pool.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()getOrCreate(PoolMap.PoolResourceSupplier<R> supplier) booleanintsize()values()
-
Field Details
-
resources
-
-
Constructor Details
-
ThreadLocalPool
public ThreadLocalPool()
-
-
Method Details
-
getOrCreate
- Specified by:
getOrCreatein interfacePoolMap.Pool<R>- Throws:
IOException
-
remove
- Specified by:
removein interfacePoolMap.Pool<R>
-
size
- Specified by:
sizein interfacePoolMap.Pool<R>
-
clear
- Specified by:
clearin interfacePoolMap.Pool<R>
-
values
- Specified by:
valuesin interfacePoolMap.Pool<R>
-