当前位置: 首页>>代码示例>>Java>>正文


Java BlockOpResponseProto.getMessage方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java BlockOpResponseProto.getMessage方法的具体用法?Java BlockOpResponseProto.getMessage怎么用?Java BlockOpResponseProto.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto的用法示例。


在下文中一共展示了BlockOpResponseProto.getMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkBlockOpStatus

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
public static void checkBlockOpStatus(
        BlockOpResponseProto response,
        String logInfo) throws IOException {
  if (response.getStatus() != Status.SUCCESS) {
    if (response.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new InvalidBlockTokenException(
        "Got access token error"
        + ", status message " + response.getMessage()
        + ", " + logInfo
      );
    } else {
      throw new IOException(
        "Got error"
        + ", status message " + response.getMessage()
        + ", " + logInfo
      );
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DataTransferProtoUtil.java

示例2: checkBlockOpStatus

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
public static void checkBlockOpStatus(
        BlockOpResponseProto response,
        String logInfo) throws IOException {
  if (response.getStatus() != Status.SUCCESS) {
    if (response.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new InvalidBlockTokenException(
        "Got access token error"
        + ", status message " + response.getMessage()
        + ", " + logInfo
      );
    } else {
      throw new IOException(
        "Got error"
        + ", status=" + response.getStatus().name()
        + ", status message " + response.getMessage()
        + ", " + logInfo
      );
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:DataTransferProtoUtil.java

示例3: receiveResponse

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
/** Receive a block copy response from the input stream */
private void receiveResponse(DataInputStream in) throws IOException {
  BlockOpResponseProto response =
      BlockOpResponseProto.parseFrom(vintPrefixed(in));
  while (response.getStatus() == Status.IN_PROGRESS) {
    // read intermediate responses
    response = BlockOpResponseProto.parseFrom(vintPrefixed(in));
  }
  if (response.getStatus() != Status.SUCCESS) {
    if (response.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new IOException("block move failed due to access token error");
    }
    throw new IOException("block move is failed: " + response.getMessage());
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:16,代码来源:Dispatcher.java

示例4: receiveResponse

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
private void receiveResponse(DataInputStream in) throws IOException {
  BlockOpResponseProto response = BlockOpResponseProto.parseFrom(
      vintPrefixed(in));
  if (response.getStatus() != Status.SUCCESS) {
    if (response.getStatus() == Status.ERROR_ACCESS_TOKEN)
      throw new IOException("block move failed due to access token error");
    throw new IOException("block move is failed: " +
        response.getMessage());
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:11,代码来源:Balancer.java

示例5: receiveResponse

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
private void receiveResponse(DataInputStream in) throws IOException {
  BlockOpResponseProto response =
      BlockOpResponseProto.parseFrom(vintPrefixed(in));
  if (response.getStatus() != Status.SUCCESS) {
    if (response.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new IOException("block move failed due to access token error");
    }
    throw new IOException("block move is failed: " + response.getMessage());
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:11,代码来源:Balancer.java

示例6: requestFileDescriptors

import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto; //导入方法依赖的package包/类
/**
 * Request file descriptors from a DomainPeer.
 *
 * @param peer   The peer to use for communication.
 * @param slot   If non-null, the shared memory slot to associate with the 
 *               new ShortCircuitReplica.
 * 
 * @return  A ShortCircuitReplica object if we could communicate with the
 *          datanode; null, otherwise. 
 * @throws  IOException If we encountered an I/O exception while communicating
 *          with the datanode.
 */
private ShortCircuitReplicaInfo requestFileDescriptors(DomainPeer peer,
        Slot slot) throws IOException {
  ShortCircuitCache cache = clientContext.getShortCircuitCache();
  final DataOutputStream out =
      new DataOutputStream(new BufferedOutputStream(peer.getOutputStream()));
  SlotId slotId = slot == null ? null : slot.getSlotId();
  new Sender(out).requestShortCircuitFds(block, token, slotId, 1);
  DataInputStream in = new DataInputStream(peer.getInputStream());
  BlockOpResponseProto resp = BlockOpResponseProto.parseFrom(
      PBHelper.vintPrefixed(in));
  DomainSocket sock = peer.getDomainSocket();
  switch (resp.getStatus()) {
  case SUCCESS:
    byte buf[] = new byte[1];
    FileInputStream fis[] = new FileInputStream[2];
    sock.recvFileInputStreams(fis, buf, 0, buf.length);
    ShortCircuitReplica replica = null;
    try {
      ExtendedBlockId key =
          new ExtendedBlockId(block.getBlockId(), block.getBlockPoolId());
      replica = new ShortCircuitReplica(key, fis[0], fis[1], cache,
          Time.monotonicNow(), slot);
    } catch (IOException e) {
      // This indicates an error reading from disk, or a format error.  Since
      // it's not a socket communication problem, we return null rather than
      // throwing an exception.
      LOG.warn(this + ": error creating ShortCircuitReplica.", e);
      return null;
    } finally {
      if (replica == null) {
        IOUtils.cleanup(DFSClient.LOG, fis[0], fis[1]);
      }
    }
    return new ShortCircuitReplicaInfo(replica);
  case ERROR_UNSUPPORTED:
    if (!resp.hasShortCircuitAccessVersion()) {
      LOG.warn("short-circuit read access is disabled for " +
          "DataNode " + datanode + ".  reason: " + resp.getMessage());
      clientContext.getDomainSocketFactory()
          .disableShortCircuitForPath(pathInfo.getPath());
    } else {
      LOG.warn("short-circuit read access for the file " +
          fileName + " is disabled for DataNode " + datanode +
          ".  reason: " + resp.getMessage());
    }
    return null;
  case ERROR_ACCESS_TOKEN:
    String msg = "access control error while " +
        "attempting to set up short-circuit access to " +
        fileName + resp.getMessage();
    if (LOG.isDebugEnabled()) {
      LOG.debug(this + ":" + msg);
    }
    return new ShortCircuitReplicaInfo(new InvalidToken(msg));
  default:
    LOG.warn(this + ": unknown response code " + resp.getStatus() +
        " while attempting to set up short-circuit access. " +
        resp.getMessage());
    clientContext.getDomainSocketFactory()
        .disableShortCircuitForPath(pathInfo.getPath());
    return null;
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:76,代码来源:BlockReaderFactory.java


注:本文中的org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。