public void downgradeToPattern ( LockPattern desiredLockPattern ) { switch ( desiredLockPattern ) { case READ : if ( mLockPattern == LockPattern . WRITE_INODE ) { Preconditions . checkState ( ! isImplicitlyLocked ( ) ) ; mLockList . downgradeLastInode ( ) ; } else if ( mLockPattern == LockPattern . WRITE_EDGE ) { downgradeEdgeToInode ( LockMode . READ ) ; } break ; case WRITE_INODE : if ( mLockPattern == LockPattern . WRITE_EDGE ) { downgradeEdgeToInode ( LockMode . WRITE ) ; } else { Preconditions . checkState ( mLockPattern == LockPattern . WRITE_INODE ) ; } break ; case WRITE_EDGE : Preconditions . checkState ( mLockPattern == LockPattern . WRITE_EDGE ) ; break ; // Nothing to do default : throw new IllegalStateException ( "Unknown lock pattern: " + desiredLockPattern ) ; } mLockPattern = desiredLockPattern ; }
Downgrades from the current locking scheme to the desired locking scheme .