gpt4 book ai didi

org.apache.hadoop.ipc.WeightedRoundRobinMultiplexer.getAndAdvanceCurrentIndex()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 05:41:05 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.ipc.WeightedRoundRobinMultiplexer.getAndAdvanceCurrentIndex()方法的一些代码示例,展示了WeightedRoundRobinMultiplexer.getAndAdvanceCurrentIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeightedRoundRobinMultiplexer.getAndAdvanceCurrentIndex()方法的具体详情如下:
包路径:org.apache.hadoop.ipc.WeightedRoundRobinMultiplexer
类名称:WeightedRoundRobinMultiplexer
方法名:getAndAdvanceCurrentIndex

WeightedRoundRobinMultiplexer.getAndAdvanceCurrentIndex介绍

[英]Use the mux by getting and advancing index.
[中]通过获取和推进索引来使用mux。

代码示例

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
 public void testCustomPattern() {
  // 1x0 1x1
  Configuration conf = new Configuration();
  conf.setStrings("test.custom." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
   "1", "1");

  mux = new WeightedRoundRobinMultiplexer(2, "test.custom", conf);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 1);

  // 1x0 3x1 2x2
  conf.setStrings("test.custom." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
   "1", "3", "2");

  mux = new WeightedRoundRobinMultiplexer(3, "test.custom", conf);

  for(int i = 0; i < 5; i++) {
   assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
  } // Ensure pattern repeats

 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
 public void testCustomPattern() {
  // 1x0 1x1
  Configuration conf = new Configuration();
  conf.setStrings("test.custom." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
   "1", "1");

  mux = new WeightedRoundRobinMultiplexer(2, "test.custom", conf);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
  assertEquals(mux.getAndAdvanceCurrentIndex(), 1);

  // 1x0 3x1 2x2
  conf.setStrings("test.custom." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
   "1", "3", "2");

  mux = new WeightedRoundRobinMultiplexer(3, "test.custom", conf);

  for(int i = 0; i < 5; i++) {
   assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
   assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
  } // Ensure pattern repeats

 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 2);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);
assertEquals(mux.getAndAdvanceCurrentIndex(), 1);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com