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


Java CachedBlock.getBlockId方法代码示例

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


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

示例1: getCacheCommand

import org.apache.hadoop.hdfs.server.namenode.CachedBlock; //导入方法依赖的package包/类
/**
 * Convert a CachedBlockList into a DatanodeCommand with a list of blocks.
 *
 * @param list       The {@link CachedBlocksList}.  This function 
 *                   clears the list.
 * @param datanode   The datanode.
 * @param action     The action to perform in the command.
 * @param poolId     The block pool id.
 * @return           A DatanodeCommand to be sent back to the DN, or null if
 *                   there is nothing to be done.
 */
private DatanodeCommand getCacheCommand(CachedBlocksList list,
    DatanodeDescriptor datanode, int action, String poolId) {
  int length = list.size();
  if (length == 0) {
    return null;
  }
  // Read the existing cache commands.
  long[] blockIds = new long[length];
  int i = 0;
  for (Iterator<CachedBlock> iter = list.iterator();
          iter.hasNext(); ) {
    CachedBlock cachedBlock = iter.next();
    blockIds[i++] = cachedBlock.getBlockId();
  }
  return new BlockIdCommand(action, poolId, blockIds);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:DatanodeManager.java

示例2: getCacheCommand

import org.apache.hadoop.hdfs.server.namenode.CachedBlock; //导入方法依赖的package包/类
/**
 * Convert a CachedBlockList into a DatanodeCommand with a list of blocks.
 *
 * @param list       The {@link CachedBlocksList}.  This function 
 *                   clears the list.
 * @param action     The action to perform in the command.
 * @param poolId     The block pool id.
 * @return           A DatanodeCommand to be sent back to the DN, or null if
 *                   there is nothing to be done.
 */
private DatanodeCommand getCacheCommand(CachedBlocksList list, int action,
    String poolId) {
  int length = list.size();
  if (length == 0) {
    return null;
  }
  // Read the existing cache commands.
  long[] blockIds = new long[length];
  int i = 0;
  for (CachedBlock cachedBlock : list) {
    blockIds[i++] = cachedBlock.getBlockId();
  }
  return new BlockIdCommand(action, poolId, blockIds);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:DatanodeManager.java


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