/** * Utility function for sending a response. * * @param status status message to write * @param message message to send to the client or other DN */ private void sendResponse(Status status, String message) throws IOException { writeResponse(status, message, getOutputStream()); }
@Override public void transferBlock(final ExtendedBlock blk, final Token<BlockTokenIdentifier> blockToken, final String clientName, final DatanodeInfo[] targets, final StorageType[] targetStorageTypes, final String[] targetStorageIds) throws IOException { previousOpClientName = clientName; updateCurrentThreadName(Op.TRANSFER_BLOCK + " " + blk); final DataOutputStream out = new DataOutputStream( getOutputStream()); checkAccess(out, true, blk, blockToken, Op.TRANSFER_BLOCK, BlockTokenIdentifier.AccessMode.COPY, targetStorageTypes, targetStorageIds); try { datanode.transferReplicaForPipelineRecovery(blk, targets, targetStorageTypes, targetStorageIds, clientName); writeResponse(Status.SUCCESS, null, out); } catch (IOException ioe) { LOG.info("transferBlock {} received exception {}", blk, ioe.toString()); incrDatanodeNetworkErrors(); throw ioe; } finally { IOUtils.closeStream(out); } }
writeResponse(SUCCESS, null, replyOut);
/** * Utility function for sending a response. * * @param status status message to write * @param message message to send to the client or other DN */ private void sendResponse(Status status, String message) throws IOException { writeResponse(status, message, getOutputStream()); }
/** * Utility function for sending a response. * * @param status status message to write * @param message message to send to the client or other DN */ private void sendResponse(Status status, String message) throws IOException { writeResponse(status, message, getOutputStream()); }
@Override public void transferBlock(final ExtendedBlock blk, final Token<BlockTokenIdentifier> blockToken, final String clientName, final DatanodeInfo[] targets, final StorageType[] targetStorageTypes) throws IOException { previousOpClientName = clientName; updateCurrentThreadName(Op.TRANSFER_BLOCK + " " + blk); final DataOutputStream out = new DataOutputStream( getOutputStream()); checkAccess(out, true, blk, blockToken, Op.TRANSFER_BLOCK, BlockTokenSecretManager.AccessMode.COPY); try { datanode.transferReplicaForPipelineRecovery(blk, targets, targetStorageTypes, clientName); writeResponse(Status.SUCCESS, null, out); } catch (IOException ioe) { LOG.info("transferBlock " + blk + " received exception " + ioe); incrDatanodeNetworkErrors(); throw ioe; } finally { IOUtils.closeStream(out); } }
@Override public void transferBlock(final ExtendedBlock blk, final Token<BlockTokenIdentifier> blockToken, final String clientName, final DatanodeInfo[] targets, final StorageType[] targetStorageTypes) throws IOException { previousOpClientName = clientName; updateCurrentThreadName(Op.TRANSFER_BLOCK + " " + blk); final DataOutputStream out = new DataOutputStream( getOutputStream()); checkAccess(out, true, blk, blockToken, Op.TRANSFER_BLOCK, BlockTokenSecretManager.AccessMode.COPY); try { datanode.transferReplicaForPipelineRecovery(blk, targets, targetStorageTypes, clientName); writeResponse(Status.SUCCESS, null, out); } catch (IOException ioe) { LOG.info("transferBlock " + blk + " received exception " + ioe); incrDatanodeNetworkErrors(); throw ioe; } finally { IOUtils.closeStream(out); } }
LOG.trace("TRANSFER: send close-ack"); writeResponse(SUCCESS, null, replyOut);
LOG.trace("TRANSFER: send close-ack"); writeResponse(SUCCESS, null, replyOut);