Class KeyedReentrantReadWriteLock
- java.lang.Object
-
- org.apache.tomcat.util.concurrent.KeyedReentrantReadWriteLock
-
public class KeyedReentrantReadWriteLock extends java.lang.ObjectProvides a reentrant read/write lock for a given key. Any locks obtained from an instance of this class using the same key will use the same underlying reentrant read/write lock as long as at least one lock for that key remains in use. Once no locks are in use for the given key, the lock is eligible for GC and the next lock obtained using that key will use a new underlying reentrant read/write lock.The class is used when Tomcat needs to manage concurrent access to components identified by a key (e.g. sessions).
The map of keys to locks is maintained so that locks are created as required and removed when no longer used.
The locks provided by this class only implement
Lock#lock()andLock#unlock(). All other methods will throwUnsupportedOperationException.
-
-
Constructor Summary
Constructors Constructor Description KeyedReentrantReadWriteLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.locks.ReadWriteLockgetLock(java.lang.String key)Obtain the reentrant read/write lock for the given key.
-