gpt4 book ai didi

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

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

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

WeightedRoundRobinMultiplexer.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

this.multiplexer = new WeightedRoundRobinMultiplexer(numQueues, ns, conf);

代码示例来源:origin: io.hops/hadoop-common

this.multiplexer = new WeightedRoundRobinMultiplexer(numQueues, ns, conf);

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

/**
 * Create a FairCallQueue.
 * @param capacity the maximum size of each sub-queue
 * @param ns the prefix to use for configuration
 * @param conf the configuration to read from
 * Notes: the FairCallQueue has no fixed capacity. Rather, it has a minimum
 * capacity of `capacity` and a maximum capacity of `capacity * number_queues`
 */
public FairCallQueue(int capacity, String ns, Configuration conf) {
 int numQueues = parseNumQueues(ns, conf);
 LOG.info("FairCallQueue is in use with " + numQueues + " queues.");
 this.queues = new ArrayList<BlockingQueue<E>>(numQueues);
 this.overflowedCalls = new ArrayList<AtomicLong>(numQueues);
 for(int i=0; i < numQueues; i++) {
  this.queues.add(new LinkedBlockingQueue<E>(capacity));
  this.overflowedCalls.add(new AtomicLong(0));
 }
 this.scheduler = new DecayRpcScheduler(numQueues, ns, conf);
 this.multiplexer = new WeightedRoundRobinMultiplexer(numQueues, ns, conf);
 // Make this the active source of metrics
 MetricsProxy mp = MetricsProxy.getInstance(ns);
 mp.setDelegate(this);
}

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

this.multiplexer = new WeightedRoundRobinMultiplexer(numQueues, ns, conf);

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateZeroMux() {
 mux = new WeightedRoundRobinMultiplexer(0, "", new Configuration());
}

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateIllegalMux() {
 Configuration conf = new Configuration();
 conf.setStrings("namespace." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
  "1", "2", "3");
 // ask for 3 weights with 2 queues
 mux = new WeightedRoundRobinMultiplexer(2, "namespace", conf);
}

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateIllegalMux() {
 Configuration conf = new Configuration();
 conf.setStrings("namespace." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
  "1", "2", "3");
 // ask for 3 weights with 2 queues
 mux = new WeightedRoundRobinMultiplexer(2, "namespace", conf);
}

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

@Test
public void testLegalInstantiation() {
 Configuration conf = new Configuration();
 conf.setStrings("namespace." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
  "1", "2", "3");
 // ask for 3 weights with 3 queues
 mux = new WeightedRoundRobinMultiplexer(3, "namespace.", conf);
}

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

@Test
public void testLegalInstantiation() {
 Configuration conf = new Configuration();
 conf.setStrings("namespace." + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY,
  "1", "2", "3");
 // ask for 3 weights with 3 queues
 mux = new WeightedRoundRobinMultiplexer(3, "namespace.", conf);
}

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateZeroMux() {
 mux = new WeightedRoundRobinMultiplexer(0, "", new Configuration());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

this.multiplexer = new WeightedRoundRobinMultiplexer(numQueues, ns, conf);

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateNegativeMux() {
 mux = new WeightedRoundRobinMultiplexer(-1, "", new Configuration());
}

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

@Test(expected=IllegalArgumentException.class)
public void testInstantiateNegativeMux() {
 mux = new WeightedRoundRobinMultiplexer(-1, "", new Configuration());
}

代码示例来源: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

@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 testDefaultPattern() {
 mux = new WeightedRoundRobinMultiplexer(1, "", new Configuration());
 for(int i = 0; i < 10; i++) {
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(2, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(3, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(4, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);

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

@Test
public void testDefaultPattern() {
 mux = new WeightedRoundRobinMultiplexer(1, "", new Configuration());
 for(int i = 0; i < 10; i++) {
  assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(2, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(3, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 mux = new WeightedRoundRobinMultiplexer(4, "", new Configuration());
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);
 assertEquals(mux.getAndAdvanceCurrentIndex(), 0);

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