gpt4 book ai didi

org.apache.samza.zk.ZkBarrierForVersionUpgrade.create()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:59:31 28 4
gpt4 key购买 nike

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

ZkBarrierForVersionUpgrade.create介绍

[英]Creates a shared barrier sub-tree in ZK
[中]在ZK中创建共享屏障子树

代码示例

代码示例来源:origin: org.apache.samza/samza-core

barrier.create(nextJMVersion, currentProcessorIds);

代码示例来源:origin: org.apache.samza/samza-core_2.10

barrier.create(nextJMVersion, currentProcessorIds);

代码示例来源:origin: org.apache.samza/samza-core_2.12

barrier.create(nextJMVersion, currentProcessorIds);

代码示例来源:origin: apache/samza

barrier.create(nextJMVersion, currentProcessorIds);

代码示例来源:origin: org.apache.samza/samza-core_2.11

barrier.create(nextJMVersion, currentProcessorIds);

代码示例来源:origin: apache/samza

@Test
public void testCleanUpZkBarrierVersion() {
 String root = zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix();
 zkUtils.getZkClient().createPersistent(root, true);
 ZkBarrierForVersionUpgrade barrier = new ZkBarrierForVersionUpgrade(root, zkUtils, null, null);
 for (int i = 200; i < 210; i++) {
  barrier.create(String.valueOf(i), new ArrayList<>(Arrays.asList(i + "a", i + "b", i + "c")));
 }
 zkUtils.deleteOldBarrierVersions(5);
 List<String> zNodeIds = zkUtils.getZkClient().getChildren(root);
 Collections.sort(zNodeIds);
 Assert.assertEquals(Arrays.asList("barrier_205", "barrier_206", "barrier_207", "barrier_208", "barrier_209"),
   zNodeIds);
}

代码示例来源:origin: apache/samza

@Test
public void testZkBarrierForVersionUpgradeWithTimeOut() {
 String barrierId = String.format("%s/%s", zkUtils1.getKeyBuilder().getRootPath(), RandomStringUtils.randomAlphabetic(4));
 List<String> processors = ImmutableList.of("p1", "p2", "p3");
 CountDownLatch latch = new CountDownLatch(2);
 TestZkBarrierListener listener = new TestZkBarrierListener(latch, State.TIMED_OUT);
 ZkBarrierForVersionUpgrade processor1Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils, listener, debounceTimer);
 ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener, debounceTimer);
 processor1Barrier.create(BARRIER_VERSION, processors);
 processor1Barrier.join(BARRIER_VERSION, "p1");
 processor2Barrier.join(BARRIER_VERSION, "p2");
 processor1Barrier.expire(BARRIER_VERSION);
 boolean result = false;
 try {
  result = latch.await(10000, TimeUnit.MILLISECONDS);
 } catch (InterruptedException e) {
  e.printStackTrace();
 }
 assertTrue("Barrier Timeout test failed to complete within test timeout.", result);
 List<String> children = zkUtils.getZkClient().getChildren(barrierId + "/barrier_1/barrier_participants");
 State barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state");
 assertEquals(State.TIMED_OUT, barrierState);
 assertNotNull(children);
 assertEquals("Unexpected barrier state. Didn't find two processors.", 2, children.size());
 assertEquals("Unexpected barrier state. Didn't find the expected members.", ImmutableList.of("p1", "p2"), children);
}

代码示例来源:origin: apache/samza

@Test
public void testZkBarrierForVersionUpgrade() {
 String barrierId = String.format("%s/%s", zkUtils1.getKeyBuilder().getRootPath(), RandomStringUtils.randomAlphabetic(4));
 List<String> processors = ImmutableList.of("p1", "p2");
 CountDownLatch latch = new CountDownLatch(2);
 TestZkBarrierListener listener = new TestZkBarrierListener(latch, State.DONE);
 ZkBarrierForVersionUpgrade processor1Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils, listener, debounceTimer);
 ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener, debounceTimer);
 processor1Barrier.create(BARRIER_VERSION, processors);
 State barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state");
 assertEquals(State.NEW, barrierState);
 processor1Barrier.join(BARRIER_VERSION, "p1");
 processor2Barrier.join(BARRIER_VERSION, "p2");
 boolean result = false;
 try {
  result = latch.await(10000, TimeUnit.MILLISECONDS);
 } catch (InterruptedException e) {
  e.printStackTrace();
 }
 assertTrue("Barrier failed to complete within test timeout.", result);
 List<String> children = zkUtils.getZkClient().getChildren(barrierId + "/barrier_1/barrier_participants");
 barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state");
 assertEquals(State.DONE, barrierState);
 assertNotNull(children);
 assertEquals("Unexpected barrier state. Didn't find two processors.", 2, children.size());
 assertEquals("Unexpected barrier state. Didn't find the expected members.", processors, children);
}

代码示例来源:origin: apache/samza

@Test
public void testShouldDiscardBarrierUpdateEventsAfterABarrierIsMarkedAsDone() {
 String barrierId = String.format("%s/%s", zkUtils1.getKeyBuilder().getRootPath(), RandomStringUtils.randomAlphabetic(4));
 List<String> processors = ImmutableList.of("p1", "p2");
 CountDownLatch latch = new CountDownLatch(2);
 TestZkBarrierListener listener = new TestZkBarrierListener(latch, State.DONE);
 ZkBarrierForVersionUpgrade processor1Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils, listener, debounceTimer);
 ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener, debounceTimer);
 processor1Barrier.create(BARRIER_VERSION, processors);
 processor1Barrier.join(BARRIER_VERSION, "p1");
 processor2Barrier.join(BARRIER_VERSION, "p2");
 boolean result = false;
 try {
  result = latch.await(10000, TimeUnit.MILLISECONDS);
 } catch (InterruptedException e) {
  e.printStackTrace();
 }
 assertTrue("Barrier Timeout test failed to complete within test timeout.", result);
 processor1Barrier.expire(BARRIER_VERSION);
 State barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state");
 assertEquals(State.DONE, barrierState);
}

代码示例来源:origin: apache/samza

ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener, debounceTimer);
processor1Barrier.create(BARRIER_VERSION, processors);

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