public void downgradeEdgeToInode ( Inode inode , LockMode mode ) { Preconditions . checkState ( ! endsInInode ( ) ) ; Preconditions . checkState ( ! mEntries . isEmpty ( ) ) ; Preconditions . checkState ( mLockMode == LockMode . WRITE ) ; EdgeEntry last = ( EdgeEntry ) mEntries . get ( mEntries . size ( ) - 1 ) ; LockResource inodeLock = mInodeLockManager . lockInode ( inode , mode ) ; LockResource edgeLock = mInodeLockManager . lockEdge ( last . mEdge , LockMode . READ ) ; last . getLock ( ) . close ( ) ; mEntries . set ( mEntries . size ( ) - 1 , new EdgeEntry ( edgeLock , last . getEdge ( ) ) ) ; mEntries . add ( new InodeEntry ( inodeLock , inode ) ) ; mLockedInodes . add ( inode ) ; mLockMode = mode ; }
Downgrades from edge write - locking to inode write - locking . This reduces the scope of the write lock by pushing it forward one entry .