Package org.apache.hadoop.hbase.util
Class IdReadWriteLockWithObjectPool<T>
java.lang.Object
org.apache.hadoop.hbase.util.IdReadWriteLock<T>
org.apache.hadoop.hbase.util.IdReadWriteLockWithObjectPool<T>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ObjectPool<T,
ReentrantReadWriteLock> The pool to get entry from, entries are mapped byReference
and will be automatically garbage-collected by JVMprivate static final int
private final IdReadWriteLockWithObjectPool.ReferenceType
-
Constructor Summary
ConstructorDescriptionConstructor of IdReadWriteLockWithObjectPool -
Method Summary
Modifier and TypeMethodDescriptionprivate void
gc()
Get the ReentrantReadWriteLock corresponding to the given id(package private) int
For testingMethods inherited from class org.apache.hadoop.hbase.util.IdReadWriteLock
waitForWaiters
-
Field Details
-
NB_CONCURRENT_LOCKS
- See Also:
-
lockPool
The pool to get entry from, entries are mapped byReference
and will be automatically garbage-collected by JVM -
refType
-
-
Constructor Details
-
IdReadWriteLockWithObjectPool
public IdReadWriteLockWithObjectPool() -
IdReadWriteLockWithObjectPool
Constructor of IdReadWriteLockWithObjectPool- Parameters:
referenceType
- type of the reference used in lock pool,IdReadWriteLockWithObjectPool.ReferenceType.WEAK
by default. UseIdReadWriteLockWithObjectPool.ReferenceType.SOFT
if the key set is limited and the locks will be reused with a high frequency
-
-
Method Details
-
getLock
Get the ReentrantReadWriteLock corresponding to the given id- Specified by:
getLock
in classIdReadWriteLock<T>
- Parameters:
id
- an arbitrary number to identify the lock
-
purgeAndGetEntryPoolSize
int purgeAndGetEntryPoolSize()For testing -
gc
-
getReferenceType
-