public void removeTempBlockMeta ( TempBlockMeta tempBlockMeta ) throws BlockDoesNotExistException { Preconditions . checkNotNull ( tempBlockMeta , "tempBlockMeta" ) ; final long blockId = tempBlockMeta . getBlockId ( ) ; final long sessionId = tempBlockMeta . getSessionId ( ) ; TempBlockMeta deletedTempBlockMeta = mBlockIdToTempBlockMap . remove ( blockId ) ; if ( deletedTempBlockMeta == null ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_META_NOT_FOUND , blockId ) ; } Set < Long > sessionBlocks = mSessionIdToTempBlockIdsMap . get ( sessionId ) ; if ( sessionBlocks == null || ! sessionBlocks . contains ( blockId ) ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_NOT_FOUND_FOR_SESSION , blockId , mTier . getTierAlias ( ) , sessionId ) ; } Preconditions . checkState ( sessionBlocks . remove ( blockId ) ) ; if ( sessionBlocks . isEmpty ( ) ) { mSessionIdToTempBlockIdsMap . remove ( sessionId ) ; } reclaimSpace ( tempBlockMeta . getBlockSize ( ) , false ) ; }
Removes a temp block from this storage dir .