private void cancelBlockWriter ( ) throws IOException { if ( mBlockWriter == null ) { return ; } try { mBlockWriter . close ( ) ; mBlockWriter = null ; mLocalBlockStore . abortBlock ( mBlockMeta . getSessionId ( ) , mBlockMeta . getBlockId ( ) ) ; } catch ( BlockDoesNotExistException e ) { // This can only happen when the session is expired. LOG . warn ( "Block {} does not exist when being aborted. The session may have expired." , mBlockMeta . getBlockId ( ) ) ; } catch ( BlockAlreadyExistsException | InvalidWorkerStateException | IOException e ) { // We cannot skip the exception here because we need to make sure that the user of this // reader does not commit the block if it fails to abort the block. throw AlluxioStatusException . fromCheckedException ( e ) ; } }
Closes the current block writer cleans up its temp block and sets it to null .