public LockResource get ( K key , LockMode mode ) { ValNode valNode = getValNode ( key ) ; ReentrantReadWriteLock lock = valNode . mValue ; switch ( mode ) { case READ : return new RefCountLockResource ( lock . readLock ( ) , true , valNode . mRefCount ) ; case WRITE : return new RefCountLockResource ( lock . writeLock ( ) , true , valNode . mRefCount ) ; default : throw new IllegalStateException ( "Unknown lock mode: " + mode ) ; } }
Locks the specified key in the specified mode .