public void validateLock ( long sessionId , long blockId , long lockId ) throws BlockDoesNotExistException , InvalidWorkerStateException { synchronized ( mSharedMapsLock ) { LockRecord record = mLockIdToRecordMap . get ( lockId ) ; if ( record == null ) { throw new BlockDoesNotExistException ( ExceptionMessage . LOCK_RECORD_NOT_FOUND_FOR_LOCK_ID , lockId ) ; } if ( sessionId != record . getSessionId ( ) ) { throw new InvalidWorkerStateException ( ExceptionMessage . LOCK_ID_FOR_DIFFERENT_SESSION , lockId , record . getSessionId ( ) , sessionId ) ; } if ( blockId != record . getBlockId ( ) ) { throw new InvalidWorkerStateException ( ExceptionMessage . LOCK_ID_FOR_DIFFERENT_BLOCK , lockId , record . getBlockId ( ) , blockId ) ; } } }
Validates the lock is hold by the given session for the given block .