private void releaseBlockLockIfUnused ( long blockId ) { synchronized ( mSharedMapsLock ) { ClientRWLock lock = mLocks . get ( blockId ) ; if ( lock == null ) { // Someone else probably released the block lock already. return ; } // If we were the last worker with a reference to the lock, clean it up. if ( lock . dropReference ( ) == 0 ) { mLocks . remove ( blockId ) ; mLockPool . release ( lock ) ; } } }
Checks whether anyone is using the block lock for the given block id returning the lock to the lock pool if it is unused .