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


Java BlockTokenSecretManager.DUMMY_TOKEN属性代码示例

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


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

示例1: sendRequest

private void sendRequest(DataOutputStream out) throws IOException {
  out.writeShort(DataTransferProtocol.DATA_TRANSFER_VERSION);
  out.writeByte(DataTransferProtocol.OP_REPLACE_BLOCK);
  out.writeLong(block.getBlock().getBlockId());
  out.writeLong(block.getBlock().getGenerationStamp());
  Text.writeString(out, source.getStorageID());
  proxySource.write(out);
  Token<BlockTokenIdentifier> accessToken = BlockTokenSecretManager.DUMMY_TOKEN;
  if (isBlockTokenEnabled) {
    accessToken = blockTokenSecretManager.generateToken(null, block.getBlock(), 
        EnumSet.of(BlockTokenSecretManager.AccessMode.REPLACE,
            BlockTokenSecretManager.AccessMode.COPY));
  }
  accessToken.write(out);
  out.flush();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:16,代码来源:Balancer.java

示例2: getAccessToken

/** Get an access token for a block. */
public Token<BlockTokenIdentifier> getAccessToken(ExtendedBlock eb
    ) throws IOException {
  if (!isBlockTokenEnabled) {
    return BlockTokenSecretManager.DUMMY_TOKEN;
  } else {
    if (!shouldRun) {
      throw new IOException(
          "Cannot get access token since BlockKeyUpdater is not running");
    }
    return blockTokenSecretManager.generateToken(null, eb,
        EnumSet.of(AccessMode.REPLACE, AccessMode.COPY));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:KeyManager.java

示例3: getAccessToken

/** Get an access token for a block. */
public Token<BlockTokenIdentifier> getAccessToken(ExtendedBlock eb
    ) throws IOException {
  if (!isBlockTokenEnabled) {
    return BlockTokenSecretManager.DUMMY_TOKEN;
  } else {
    if (!shouldRun) {
      throw new IOException(
          "Cannot get access token since BlockKeyUpdater is not running");
    }
    return blockTokenSecretManager.generateToken(null, eb,
        EnumSet.of(BlockTokenIdentifier.AccessMode.REPLACE, BlockTokenIdentifier.AccessMode.COPY));
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:14,代码来源:KeyManager.java

示例4: getBlockAccessToken

/***
 * Use BlockTokenSecretManager to generate block token for current user.
 */
public Token<BlockTokenIdentifier> getBlockAccessToken(ExtendedBlock b,
    EnumSet<AccessMode> mode) throws IOException {
  Token<BlockTokenIdentifier> accessToken = 
      BlockTokenSecretManager.DUMMY_TOKEN;
  if (isBlockTokenEnabled) {
    accessToken = blockPoolTokenSecretManager.generateToken(b, mode);
  }
  return accessToken;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:12,代码来源:DataNode.java

示例5: getAccessToken

/** Get an access token for a block. */
Token<BlockTokenIdentifier> getAccessToken(ExtendedBlock eb
    ) throws IOException {
  if (!isBlockTokenEnabled) {
    return BlockTokenSecretManager.DUMMY_TOKEN;
  } else {
    if (!shouldRun) {
      throw new IOException(
          "Can not get access token. BlockKeyUpdater is not running");
    }
    return blockTokenSecretManager.generateToken(null, eb,
        EnumSet.of(BlockTokenSecretManager.AccessMode.REPLACE,
        BlockTokenSecretManager.AccessMode.COPY));
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:15,代码来源:NameNodeConnector.java

示例6: getAccessToken

/**
 * Get an access token for a block.
 */
Token<BlockTokenIdentifier> getAccessToken(ExtendedBlock eb)
    throws IOException {
  if (!isBlockTokenEnabled) {
    return BlockTokenSecretManager.DUMMY_TOKEN;
  } else {
    if (!shouldRun) {
      throw new IOException(
          "Can not get access token. BlockKeyUpdater is not running");
    }
    return blockTokenSecretManager.generateToken(null, eb, EnumSet
            .of(BlockTokenSecretManager.AccessMode.REPLACE,
                BlockTokenSecretManager.AccessMode.COPY));
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:NameNodeConnector.java

示例7: sendRequest

private void sendRequest(DataOutputStream out) throws IOException {
  Token<BlockTokenIdentifier> accessToken = BlockTokenSecretManager.DUMMY_TOKEN;
  if (isBlockTokenEnabled) {
    accessToken = blockTokenSecretManager.generateToken(null, block
        .getBlock(), EnumSet.of(BlockTokenSecretManager.AccessMode.REPLACE,
        BlockTokenSecretManager.AccessMode.COPY));
  }
  DataTransferProtocol.Sender.opReplaceBlock(out,
      block.getBlock(), source.getStorageID(), 
      proxySource.getDatanode(), accessToken);
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:11,代码来源:Balancer.java

示例8: run

/**
 * Do the deed, write the bytes
 */
public void run() {
  xmitsInProgress.getAndIncrement();
  Socket sock = null;
  DataOutputStream out = null;
  BlockSender blockSender = null;
  
  try {
    InetSocketAddress curTarget = 
      NetUtils.createSocketAddr(targets[0].getName());
    sock = newSocket();
    NetUtils.connect(sock, curTarget, socketTimeout);
    sock.setSoTimeout(targets.length * socketTimeout);

    long writeTimeout = socketWriteTimeout + 
                        HdfsConstants.WRITE_TIMEOUT_EXTENSION * (targets.length-1);
    OutputStream baseStream = NetUtils.getOutputStream(sock, writeTimeout);
    out = new DataOutputStream(new BufferedOutputStream(baseStream, 
                                                        SMALL_BUFFER_SIZE));

    blockSender = new BlockSender(b, 0, b.getNumBytes(), false, false, false, 
        datanode);
    DatanodeInfo srcNode = new DatanodeInfo(dnRegistration);

    //
    // Header info
    //
    out.writeShort(DataTransferProtocol.DATA_TRANSFER_VERSION);
    out.writeByte(DataTransferProtocol.OP_WRITE_BLOCK);
    out.writeLong(b.getBlockId());
    out.writeLong(b.getGenerationStamp());
    out.writeInt(0);           // no pipelining
    out.writeBoolean(false);   // not part of recovery
    Text.writeString(out, ""); // client
    out.writeBoolean(true); // sending src node information
    srcNode.write(out); // Write src node DatanodeInfo
    // write targets
    out.writeInt(targets.length - 1);
    for (int i = 1; i < targets.length; i++) {
      targets[i].write(out);
    }
    Token<BlockTokenIdentifier> accessToken = BlockTokenSecretManager.DUMMY_TOKEN;
    if (isBlockTokenEnabled) {
      accessToken = blockTokenSecretManager.generateToken(null, b,
          EnumSet.of(BlockTokenSecretManager.AccessMode.WRITE));
    }
    accessToken.write(out);
    // send data & checksum
    blockSender.sendBlock(out, baseStream, null);

    // no response necessary
    LOG.info(dnRegistration + ":Transmitted block " + b + " to " + curTarget);

  } catch (IOException ie) {
    LOG.warn(dnRegistration + ":Failed to transfer " + b + " to " + targets[0].getName()
        + " got " + StringUtils.stringifyException(ie));
    // check if there are any disk problem
    datanode.checkDiskError();
    
  } finally {
    xmitsInProgress.getAndDecrement();
    IOUtils.closeStream(blockSender);
    IOUtils.closeStream(out);
    IOUtils.closeSocket(sock);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:68,代码来源:DataNode.java

示例9: run

/**
 * Do the deed, write the bytes
 */
public void run() {
  xmitsInProgress.getAndIncrement();
  Socket sock = null;
  DataOutputStream out = null;
  BlockSender blockSender = null;
  
  try {
    InetSocketAddress curTarget = 
      NetUtils.createSocketAddr(targets[0].getName());
    sock = newSocket();
    NetUtils.connect(sock, curTarget, socketTimeout);
    sock.setSoTimeout(targets.length * socketTimeout);

    long writeTimeout = socketWriteTimeout + 
                        HdfsConstants.WRITE_TIMEOUT_EXTENSION * (targets.length-1);
    OutputStream baseStream = NetUtils.getOutputStream(sock, writeTimeout);
    out = new DataOutputStream(new BufferedOutputStream(baseStream, 
                                                        SMALL_BUFFER_SIZE));

    blockSender = new BlockSender(b, 0, b.getNumBytes(), 
        false, false, false, datanode);
    DatanodeInfo srcNode = new DatanodeInfo(dnRegistration);

    //
    // Header info
    //
    Token<BlockTokenIdentifier> accessToken = BlockTokenSecretManager.DUMMY_TOKEN;
    if (isBlockTokenEnabled) {
      accessToken = blockTokenSecretManager.generateToken(null, b,
      EnumSet.of(BlockTokenSecretManager.AccessMode.WRITE));
    }
    DataTransferProtocol.Sender.opWriteBlock(out,
        b, 0, BlockConstructionStage.PIPELINE_SETUP_CREATE, 0, 0, 0, "",
        srcNode, targets, accessToken);

    // send data & checksum
    blockSender.sendBlock(out, baseStream, null);

    // no response necessary
    LOG.info(dnRegistration + ":Transmitted block " + b + " to " + curTarget);

  } catch (IOException ie) {
    LOG.warn(dnRegistration + ":Failed to transfer " + b + " to " + targets[0].getName()
        + " got " + StringUtils.stringifyException(ie));
    // check if there are any disk problem
    datanode.checkDiskError();
    
  } finally {
    xmitsInProgress.getAndDecrement();
    IOUtils.closeStream(blockSender);
    IOUtils.closeStream(out);
    IOUtils.closeSocket(sock);
  }
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:57,代码来源:DataNode.java


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