• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExtendedBlockId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hdfs.ExtendedBlockId的典型用法代码示例。如果您正苦于以下问题:Java ExtendedBlockId类的具体用法?Java ExtendedBlockId怎么用?Java ExtendedBlockId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: allocSlotFromExistingShm

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Pull a slot out of a preexisting shared memory segment.
 *
 * Must be called with the manager lock held.
 *
 * @param blockId     The blockId to put inside the Slot object.
 *
 * @return            null if none of our shared memory segments contain a
 *                      free slot; the slot object otherwise.
 */
private Slot allocSlotFromExistingShm(ExtendedBlockId blockId) {
  if (notFull.isEmpty()) {
    return null;
  }
  Entry<ShmId, DfsClientShm> entry = notFull.firstEntry();
  DfsClientShm shm = entry.getValue();
  ShmId shmId = shm.getShmId();
  Slot slot = shm.allocAndRegisterSlot(blockId);
  if (shm.isFull()) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(this + ": pulled the last slot " + slot.getSlotIdx() +
          " out of " + shm);
    }
    DfsClientShm removedShm = notFull.remove(shmId);
    Preconditions.checkState(removedShm == shm);
    full.put(shmId, shm);
  } else {
    if (LOG.isTraceEnabled()) {
      LOG.trace(this + ": pulled slot " + slot.getSlotIdx() +
          " out of " + shm);
    }
  }
  return slot;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:DfsClientShmManager.java


示例2: allocSlot

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer,
    MutableBoolean usedPeer, ExtendedBlockId blockId,
    String clientName) throws IOException {
  lock.lock();
  try {
    if (closed) {
      LOG.trace(this + ": the DfsClientShmManager isclosed.");
      return null;
    }
    EndpointShmManager shmManager = datanodes.get(datanode);
    if (shmManager == null) {
      shmManager = new EndpointShmManager(datanode);
      datanodes.put(datanode, shmManager);
    }
    return shmManager.allocSlot(peer, usedPeer, clientName, blockId);
  } finally {
    lock.unlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DfsClientShmManager.java


示例3: allocAndRegisterSlot

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Allocate a new slot and register it.
 *
 * This function chooses an empty slot, initializes it, and then returns
 * the relevant Slot object.
 *
 * @return    The new slot.
 */
synchronized public final Slot allocAndRegisterSlot(
    ExtendedBlockId blockId) {
  int idx = allocatedSlots.nextClearBit(0);
  if (idx >= slots.length) {
    throw new RuntimeException(this + ": no more slots are available.");
  }
  allocatedSlots.set(idx, true);
  Slot slot = new Slot(calculateSlotAddress(idx), blockId);
  slot.clear();
  slot.makeValid();
  slots[idx] = slot;
  if (LOG.isTraceEnabled()) {
    LOG.trace(this + ": allocAndRegisterSlot " + idx + ": allocatedSlots=" + allocatedSlots +
                StringUtils.getStackTrace(Thread.currentThread()));
  }
  return slot;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:ShortCircuitShm.java


示例4: ShortCircuitReplica

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
public ShortCircuitReplica(ExtendedBlockId key,
    FileInputStream dataStream, FileInputStream metaStream,
    ShortCircuitCache cache, long creationTimeMs, Slot slot) throws IOException {
  this.key = key;
  this.dataStream = dataStream;
  this.metaStream = metaStream;
  this.metaHeader =
        BlockMetadataHeader.preadHeader(metaStream.getChannel());
  if (metaHeader.getVersion() != 1) {
    throw new IOException("invalid metadata header version " +
        metaHeader.getVersion() + ".  Can only handle version 1.");
  }
  this.cache = cache;
  this.creationTimeMs = creationTimeMs;
  this.slot = slot;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ShortCircuitReplica.java


示例5: cacheBlock

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Attempt to begin caching a block.
 */
synchronized void cacheBlock(long blockId, String bpid,
    String blockFileName, long length, long genstamp,
    Executor volumeExecutor) {
  ExtendedBlockId key = new ExtendedBlockId(blockId, bpid);
  Value prevValue = mappableBlockMap.get(key);
  if (prevValue != null) {
    LOG.debug("Block with id {}, pool {} already exists in the "
            + "FsDatasetCache with state {}", blockId, bpid, prevValue.state
    );
    numBlocksFailedToCache.incrementAndGet();
    return;
  }
  mappableBlockMap.put(key, new Value(null, State.CACHING));
  volumeExecutor.execute(
      new CachingTask(key, blockFileName, length, genstamp));
  LOG.debug("Initiating caching for Block with id {}, pool {}", blockId,
      bpid);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:FsDatasetCache.java


示例6: invalidate

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Invalidate a block but does not delete the actual on-disk block file.
 *
 * It should only be used when deactivating disks.
 *
 * @param bpid the block pool ID.
 * @param block The block to be invalidated.
 */
public void invalidate(String bpid, ReplicaInfo block) {
  // If a DFSClient has the replica in its cache of short-circuit file
  // descriptors (and the client is using ShortCircuitShm), invalidate it.
  // The short-circuit registry is null in the unit tests, because the
  // datanode is mock object.
  if (datanode.getShortCircuitRegistry() != null) {
    datanode.getShortCircuitRegistry().processBlockInvalidation(
        new ExtendedBlockId(block.getBlockId(), bpid));

    // If the block is cached, start uncaching it.
    cacheManager.uncacheBlock(bpid, block.getBlockId());
  }

  datanode.notifyNamenodeDeletedBlock(new ExtendedBlock(bpid, block),
      block.getStorageUuid());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FsDatasetImpl.java


示例7: processBlockInvalidation

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Invalidate any slot associated with a blockId that we are invalidating
 * (deleting) from this DataNode.  When a slot is invalid, the DFSClient will
 * not use the corresponding replica for new read or mmap operations (although
 * existing, ongoing read or mmap operations will complete.)
 *
 * @param blockId        The block ID.
 */
public synchronized void processBlockInvalidation(ExtendedBlockId blockId) {
  if (!enabled) return;
  final Set<Slot> affectedSlots = slots.get(blockId);
  if (!affectedSlots.isEmpty()) {
    final StringBuilder bld = new StringBuilder();
    String prefix = "";
    bld.append("Block ").append(blockId).append(" has been invalidated.  ").
        append("Marking short-circuit slots as invalid: ");
    for (Slot slot : affectedSlots) {
      slot.makeInvalid();
      bld.append(prefix).append(slot.toString());
      prefix = ", ";
    }
    LOG.info(bld.toString());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:ShortCircuitRegistry.java


示例8: visit

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
@Override
public void visit(int numOutstandingMmaps,
    Map<ExtendedBlockId, ShortCircuitReplica> replicas,
    Map<ExtendedBlockId, InvalidToken> failedLoads,
    Map<Long, ShortCircuitReplica> evictable,
    Map<Long, ShortCircuitReplica> evictableMmapped) {
  if (expectedNumOutstandingMmaps >= 0) {
    Assert.assertEquals(expectedNumOutstandingMmaps, numOutstandingMmaps);
  }
  if (expectedNumReplicas >= 0) {
    Assert.assertEquals(expectedNumReplicas, replicas.size());
  }
  if (expectedNumEvictable >= 0) {
    Assert.assertEquals(expectedNumEvictable, evictable.size());
  }
  if (expectedNumMmapedEvictable >= 0) {
    Assert.assertEquals(expectedNumMmapedEvictable, evictableMmapped.size());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestEnhancedByteBufferAccess.java


示例9: allocSlotFromExistingShm

import org.apache.hadoop.hdfs.ExtendedBlockId; //导入依赖的package包/类
/**
 * Pull a slot out of a preexisting shared memory segment.
 *
 * Must be called with the manager lock held.
 *
 * @param blockId     The blockId to put inside the Slot object.
 *
 * @return            null if none of our shared memory segments contain a
 *                      free slot; the slot object otherwise.
 */
private Slot allocSlotFromExistingShm(ExtendedBlockId blockId) {
  if (notFull.isEmpty()) {
    return null;
  }
  Entry<ShmId, DfsClientShm> entry = notFull.firstEntry();
  DfsClientShm shm = entry.getValue();
  ShmId shmId = shm.getShmId();
  Slot slot = shm.allocAndRegisterSlot(blockId);
  if (shm.isFull()) {
    LOG.trace("{}: pulled the last slot {} out of {}",
        this, slot.getSlotIdx(), shm);
    DfsClientShm removedShm = notFull.remove(shmId);
    Preconditions.checkState(removedShm == shm);
    full.put(shmId, shm);
  } else {
    LOG.trace("{}: pulled slot {} out of {}", this, slot.getSlotIdx(), shm);
  }
  return slot;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:30,代码来源:DfsClientShmManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Grid类代码示例发布时间:2022-05-23
下一篇:
Java ActionErrors类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap