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


Java ShortCircuitRegistry类代码示例

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


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

示例1: setUp

import org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  datanode = mock(DataNode.class);
  storage = mock(DataStorage.class);
  this.conf = new Configuration();
  this.conf.setLong(DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, 0);
  final DNConf dnConf = new DNConf(conf);

  when(datanode.getConf()).thenReturn(conf);
  when(datanode.getDnConf()).thenReturn(dnConf);
  final BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);
  when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);
  final ShortCircuitRegistry shortCircuitRegistry =
      new ShortCircuitRegistry(conf);
  when(datanode.getShortCircuitRegistry()).thenReturn(shortCircuitRegistry);

  createStorageDirs(storage, conf, NUM_INIT_VOLUMES);
  dataset = new FsDatasetImpl(datanode, storage, conf);
  for (String bpid : BLOCK_POOL_IDS) {
    dataset.addBlockPool(bpid, conf);
  }

  assertEquals(NUM_INIT_VOLUMES, getNumVolumes());
  assertEquals(0, dataset.getNumFailedVolumes());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:TestFsDatasetImpl.java

示例2: checkNumberOfSegmentsAndSlots

import org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry; //导入依赖的package包/类
static private void checkNumberOfSegmentsAndSlots(final int expectedSegments,
      final int expectedSlots, ShortCircuitRegistry registry) {
  registry.visit(new ShortCircuitRegistry.Visitor() {
    @Override
    public void accept(HashMap<ShmId, RegisteredShm> segments,
                       HashMultimap<ExtendedBlockId, Slot> slots) {
      Assert.assertEquals(expectedSegments, segments.size());
      Assert.assertEquals(expectedSlots, slots.size());
    }
  });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestShortCircuitCache.java

示例3: testPreReceiptVerificationDfsClientCanDoScr

import org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry; //导入依赖的package包/类
@Test(timeout=60000)
public void testPreReceiptVerificationDfsClientCanDoScr() throws Exception {
  BlockReaderTestUtil.enableShortCircuitShmTracing();
  TemporarySocketDirectory sockDir = new TemporarySocketDirectory();
  Configuration conf = createShortCircuitConf(
      "testPreReceiptVerificationDfsClientCanDoScr", sockDir);
  conf.setLong(DFS_CLIENT_READ_SHORTCIRCUIT_STREAMS_CACHE_EXPIRY_MS_KEY,
      1000000000L);
  MiniDFSCluster cluster =
      new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  cluster.waitActive();
  DistributedFileSystem fs = cluster.getFileSystem();
  fs.getClient().getConf().brfFailureInjector =
      new TestPreReceiptVerificationFailureInjector();
  final Path TEST_PATH1 = new Path("/test_file1");
  DFSTestUtil.createFile(fs, TEST_PATH1, 4096, (short)1, 0xFADE2);
  final Path TEST_PATH2 = new Path("/test_file2");
  DFSTestUtil.createFile(fs, TEST_PATH2, 4096, (short)1, 0xFADE2);
  DFSTestUtil.readFileBuffer(fs, TEST_PATH1);
  DFSTestUtil.readFileBuffer(fs, TEST_PATH2);
  ShortCircuitRegistry registry =
      cluster.getDataNodes().get(0).getShortCircuitRegistry();
  registry.visit(new ShortCircuitRegistry.Visitor() {
    @Override
    public void accept(HashMap<ShmId, RegisteredShm> segments,
                       HashMultimap<ExtendedBlockId, Slot> slots) {
      Assert.assertEquals(1, segments.size());
      Assert.assertEquals(2, slots.size());
    }
  });
  cluster.shutdown();
  sockDir.close();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:TestShortCircuitCache.java

示例4: enableShortCircuitShmTracing

import org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry; //导入依赖的package包/类
public static void enableShortCircuitShmTracing() {
  LogManager.getLogger(DfsClientShmManager.class.getName()).setLevel(
      Level.TRACE);
  LogManager.getLogger(ShortCircuitRegistry.class.getName()).setLevel(
      Level.TRACE);
  LogManager.getLogger(ShortCircuitShm.class.getName()).setLevel(
      Level.TRACE);
  LogManager.getLogger(DataNode.class.getName()).setLevel(
      Level.TRACE);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:BlockReaderTestUtil.java

示例5: testPreReceiptVerificationDfsClientCanDoScr

import org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry; //导入依赖的package包/类
@Test(timeout=60000)
public void testPreReceiptVerificationDfsClientCanDoScr() throws Exception {
  BlockReaderTestUtil.enableShortCircuitShmTracing();
  TemporarySocketDirectory sockDir = new TemporarySocketDirectory();
  Configuration conf = createShortCircuitConf(
      "testPreReceiptVerificationDfsClientCanDoScr", sockDir);
  conf.setLong(
      HdfsClientConfigKeys.Read.ShortCircuit.STREAMS_CACHE_EXPIRY_MS_KEY,
      1000000000L);
  MiniDFSCluster cluster =
      new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  cluster.waitActive();
  DistributedFileSystem fs = cluster.getFileSystem();
  BlockReaderFactory.setFailureInjectorForTesting(
      new TestPreReceiptVerificationFailureInjector());
  final Path TEST_PATH1 = new Path("/test_file1");
  DFSTestUtil.createFile(fs, TEST_PATH1, 4096, (short)1, 0xFADE2);
  final Path TEST_PATH2 = new Path("/test_file2");
  DFSTestUtil.createFile(fs, TEST_PATH2, 4096, (short)1, 0xFADE2);
  DFSTestUtil.readFileBuffer(fs, TEST_PATH1);
  DFSTestUtil.readFileBuffer(fs, TEST_PATH2);
  ShortCircuitRegistry registry =
      cluster.getDataNodes().get(0).getShortCircuitRegistry();
  registry.visit(new ShortCircuitRegistry.Visitor() {
    @Override
    public void accept(HashMap<ShmId, RegisteredShm> segments,
                       HashMultimap<ExtendedBlockId, Slot> slots) {
      Assert.assertEquals(1, segments.size());
      Assert.assertEquals(2, slots.size());
    }
  });
  cluster.shutdown();
  sockDir.close();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:35,代码来源:TestShortCircuitCache.java


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