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


Java Status.ERROR_ACCESS_TOKEN属性代码示例

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


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

示例1: checkBlockOpStatus

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,代码行数:19,代码来源:DataTransferProtoUtil.java

示例2: checkBlockOpStatus

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,代码行数:20,代码来源:DataTransferProtoUtil.java

示例3: checkSuccess

static void checkSuccess(
    BlockOpResponseProto status, Peer peer,
    ExtendedBlock block, String file)
    throws IOException {
  if (status.getStatus() != Status.SUCCESS) {
    if (status.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new InvalidBlockTokenException(
          "Got access token error for OP_READ_BLOCK, self="
              + peer.getLocalAddressString() + ", remote="
              + peer.getRemoteAddressString() + ", for file " + file
              + ", for pool " + block.getBlockPoolId() + " block " 
              + block.getBlockId() + "_" + block.getGenerationStamp());
    } else {
      throw new IOException("Got error for OP_READ_BLOCK, self="
          + peer.getLocalAddressString() + ", remote="
          + peer.getRemoteAddressString() + ", for file " + file
          + ", for pool " + block.getBlockPoolId() + " block " 
          + block.getBlockId() + "_" + block.getGenerationStamp());
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:RemoteBlockReader2.java

示例4: checkSuccess

static void checkSuccess(BlockOpResponseProto status, Socket sock,
    ExtendedBlock block, String file) throws IOException {
  if (status.getStatus() != Status.SUCCESS) {
    if (status.getStatus() == Status.ERROR_ACCESS_TOKEN) {
      throw new InvalidBlockTokenException(
          "Got access token error for OP_READ_BLOCK, self=" +
              sock.getLocalSocketAddress() + ", remote=" +
              sock.getRemoteSocketAddress() + ", for file " + file +
              ", for pool " + block.getBlockPoolId() + " block " +
              block.getBlockId() + "_" + block.getGenerationStamp());
    } else {
      throw new IOException("Got error for OP_READ_BLOCK, self=" +
          sock.getLocalSocketAddress() + ", remote=" +
          sock.getRemoteSocketAddress() + ", for file " + file +
          ", for pool " + block.getBlockPoolId() + " block " +
          block.getBlockId() + "_" + block.getGenerationStamp());
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:RemoteBlockReader2.java

示例5: inferChecksumTypeByReading

/**
 * Infer the checksum type for a replica by sending an OP_READ_BLOCK
 * for the first byte of that replica. This is used for compatibility
 * with older HDFS versions which did not include the checksum type in
 * OpBlockChecksumResponseProto.
 *
 * @param lb the located block
 * @param dn the connected datanode
 * @return the inferred checksum type
 * @throws IOException if an error occurs
 */
private Type inferChecksumTypeByReading(LocatedBlock lb, DatanodeInfo dn)
    throws IOException {
  IOStreamPair pair = connectToDN(dn, dfsClientConf.socketTimeout, lb);

  try {
    DataOutputStream out = new DataOutputStream(new BufferedOutputStream(pair.out,
        HdfsConstants.SMALL_BUFFER_SIZE));
    DataInputStream in = new DataInputStream(pair.in);

    new Sender(out).readBlock(lb.getBlock(), lb.getBlockToken(), clientName,
        0, 1, true, CachingStrategy.newDefaultStrategy());
    final BlockOpResponseProto reply =
        BlockOpResponseProto.parseFrom(PBHelper.vintPrefixed(in));
    
    if (reply.getStatus() != Status.SUCCESS) {
      if (reply.getStatus() == Status.ERROR_ACCESS_TOKEN) {
        throw new InvalidBlockTokenException();
      } else {
        throw new IOException("Bad response " + reply + " trying to read "
            + lb.getBlock() + " from datanode " + dn);
      }
    }
    
    return PBHelper.convert(reply.getReadOpChecksumInfo().getChecksum().getType());
  } finally {
    IOUtils.cleanup(null, pair.in, pair.out);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:39,代码来源:DFSClient.java

示例6: receiveResponse

/** 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,代码行数:15,代码来源:Dispatcher.java

示例7: inferChecksumTypeByReading

/**
 * Infer the checksum type for a replica by sending an OP_READ_BLOCK
 * for the first byte of that replica. This is used for compatibility
 * with older HDFS versions which did not include the checksum type in
 * OpBlockChecksumResponseProto.
 *
 * @param in input stream from datanode
 * @param out output stream to datanode
 * @param lb the located block
 * @param clientName the name of the DFSClient requesting the checksum
 * @param dn the connected datanode
 * @return the inferred checksum type
 * @throws IOException if an error occurs
 */
private static Type inferChecksumTypeByReading(
    String clientName, SocketFactory socketFactory, int socketTimeout,
    LocatedBlock lb, DatanodeInfo dn,
    DataEncryptionKey encryptionKey, boolean connectToDnViaHostname)
    throws IOException {
  IOStreamPair pair = connectToDN(socketFactory, connectToDnViaHostname,
      encryptionKey, dn, socketTimeout);

  try {
    DataOutputStream out = new DataOutputStream(new BufferedOutputStream(pair.out,
        HdfsConstants.SMALL_BUFFER_SIZE));
    DataInputStream in = new DataInputStream(pair.in);

    new Sender(out).readBlock(lb.getBlock(), lb.getBlockToken(), clientName, 0, 1, true);
    final BlockOpResponseProto reply =
        BlockOpResponseProto.parseFrom(PBHelper.vintPrefixed(in));
    
    if (reply.getStatus() != Status.SUCCESS) {
      if (reply.getStatus() == Status.ERROR_ACCESS_TOKEN) {
        throw new InvalidBlockTokenException();
      } else {
        throw new IOException("Bad response " + reply + " trying to read "
            + lb.getBlock() + " from datanode " + dn);
      }
    }
    
    return PBHelper.convert(reply.getReadOpChecksumInfo().getChecksum().getType());
  } finally {
    IOUtils.cleanup(null, pair.in, pair.out);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:45,代码来源:DFSClient.java

示例8: receiveResponse

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,代码行数:10,代码来源:Balancer.java

示例9: inferChecksumTypeByReading

/**
 * Infer the checksum type for a replica by sending an OP_READ_BLOCK
 * for the first byte of that replica. This is used for compatibility
 * with older HDFS versions which did not include the checksum type in
 * OpBlockChecksumResponseProto.
 *
 * @param lb
 *     the located block
 * @param clientName
 *     the name of the DFSClient requesting the checksum
 * @param dn
 *     the connected datanode
 * @return the inferred checksum type
 * @throws IOException
 *     if an error occurs
 */
private static Type inferChecksumTypeByReading(String clientName,
    SocketFactory socketFactory, int socketTimeout, LocatedBlock lb,
    DatanodeInfo dn, DataEncryptionKey encryptionKey,
    boolean connectToDnViaHostname) throws IOException {
  IOStreamPair pair =
      connectToDN(socketFactory, connectToDnViaHostname, encryptionKey, dn,
          socketTimeout);

  try {
    DataOutputStream out = new DataOutputStream(
        new BufferedOutputStream(pair.out, HdfsConstants.SMALL_BUFFER_SIZE));
    DataInputStream in = new DataInputStream(pair.in);

    new Sender(out)
        .readBlock(lb.getBlock(), lb.getBlockToken(), clientName, 0, 1, true);
    final BlockOpResponseProto reply =
        BlockOpResponseProto.parseFrom(PBHelper.vintPrefixed(in));
    
    if (reply.getStatus() != Status.SUCCESS) {
      if (reply.getStatus() == Status.ERROR_ACCESS_TOKEN) {
        throw new InvalidBlockTokenException();
      } else {
        throw new IOException(
            "Bad response " + reply + " trying to read " + lb.getBlock() +
                " from datanode " + dn);
      }
    }
    
    return PBHelper
        .convert(reply.getReadOpChecksumInfo().getChecksum().getType());
  } finally {
    IOUtils.cleanup(null, pair.in, pair.out);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:50,代码来源:DFSClient.java

示例10: receiveResponse

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,代码行数:10,代码来源:Balancer.java


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