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

x33g5p2x  于2022-02-05 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(85)

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

ZkKeyBuilder.getProcessorsPath介绍

暂无

代码示例

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

/**
 * Method is used to get the <i>sorted</i> list of currently active/registered processors (znodes)
 *
 * @return List of absolute ZK node paths
 */
public List<String> getSortedActiveProcessorsZnodes() {
 List<String> znodeIds = zkClient.getChildren(keyBuilder.getProcessorsPath());
 if (znodeIds.size() > 0) {
  Collections.sort(znodeIds);
  LOG.info("Found these children - " + znodeIds);
 }
 return znodeIds;
}

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

/**
 * subscribe to the changes in the list of processors in ZK
 * @param listener - will be called when a processor is added or removed.
 */
public void subscribeToProcessorChange(IZkChildListener listener) {
 LOG.info("Subscribing for child change at:" + keyBuilder.getProcessorsPath());
 zkClient.subscribeChildChanges(keyBuilder.getProcessorsPath(), listener);
 metrics.subscriptions.inc();
}

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

/**
 * subscribe to the changes in the list of processors in ZK
 * @param listener - will be called when a processor is added or removed.
 */
public void subscribeToProcessorChange(IZkChildListener listener) {
 LOG.info("Subscribing for child change at:" + keyBuilder.getProcessorsPath());
 zkClient.subscribeChildChanges(keyBuilder.getProcessorsPath(), listener);
 metrics.subscriptions.inc();
}

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

/**
 * subscribe to the changes in the list of processors in ZK
 * @param listener - will be called when a processor is added or removed.
 */
public void subscribeToProcessorChange(IZkChildListener listener) {
 LOG.info("Subscribing for child change at:" + keyBuilder.getProcessorsPath());
 zkClient.subscribeChildChanges(keyBuilder.getProcessorsPath(), listener);
 metrics.subscriptions.inc();
}

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

/**
 * subscribe to the changes in the list of processors in ZK
 * @param listener - will be called when a processor is added or removed.
 */
public void subscribeToProcessorChange(IZkChildListener listener) {
 LOG.info("Subscribing for child change at:" + keyBuilder.getProcessorsPath());
 zkClient.subscribeChildChanges(keyBuilder.getProcessorsPath(), listener);
 metrics.subscriptions.inc();
}

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

/**
 * subscribe to the changes in the list of processors in ZK
 * @param listener - will be called when a processor is added or removed.
 */
public void subscribeToProcessorChange(IZkChildListener listener) {
 LOG.info("Subscribing for child change at:" + keyBuilder.getProcessorsPath());
 zkClient.subscribeChildChanges(keyBuilder.getProcessorsPath(), listener);
 metrics.subscriptions.inc();
}

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

/**
 * Method is used to get the <i>sorted</i> list of currently active/registered processors (znodes)
 *
 * @return List of absolute ZK node paths
 */
public List<String> getSortedActiveProcessorsZnodes() {
 List<String> znodeIds = zkClient.getChildren(keyBuilder.getProcessorsPath());
 if (znodeIds.size() > 0) {
  Collections.sort(znodeIds);
  LOG.info("Found these children - " + znodeIds);
 }
 return znodeIds;
}

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

/**
 * Method is used to get the <i>sorted</i> list of currently active/registered processors (znodes)
 *
 * @return List of absolute ZK node paths
 */
public List<String> getSortedActiveProcessorsZnodes() {
 List<String> znodeIds = zkClient.getChildren(keyBuilder.getProcessorsPath());
 if (znodeIds.size() > 0) {
  Collections.sort(znodeIds);
  LOG.info("Found these children - " + znodeIds);
 }
 return znodeIds;
}

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

public ZkLeaderElector(String processorIdStr, ZkUtils zkUtils) {
 this.processorIdStr = processorIdStr;
 this.zkUtils = zkUtils;
 this.keyBuilder = zkUtils.getKeyBuilder();
 this.hostName = getHostName();
 this.previousProcessorChangeListener = new PreviousProcessorChangeListener(zkUtils);
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath()});
}

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

public ZkLeaderElector(String processorIdStr, ZkUtils zkUtils) {
 this.processorIdStr = processorIdStr;
 this.zkUtils = zkUtils;
 this.keyBuilder = zkUtils.getKeyBuilder();
 this.hostName = getHostName();
 this.previousProcessorChangeListener = new PreviousProcessorChangeListener(zkUtils);
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath()});
}

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

public ZkLeaderElector(String processorIdStr, ZkUtils zkUtils) {
 this.processorIdStr = processorIdStr;
 this.zkUtils = zkUtils;
 this.keyBuilder = zkUtils.getKeyBuilder();
 this.hostName = getHostName();
 this.previousProcessorChangeListener = new PreviousProcessorChangeListener(zkUtils);
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath()});
}

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

public ZkLeaderElector(String processorIdStr, ZkUtils zkUtils) {
 this.processorIdStr = processorIdStr;
 this.zkUtils = zkUtils;
 this.keyBuilder = zkUtils.getKeyBuilder();
 this.hostName = getHostName();
 this.previousProcessorChangeListener = new PreviousProcessorChangeListener(zkUtils);
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath()});
}

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

public ZkLeaderElector(String processorIdStr, ZkUtils zkUtils) {
 this.processorIdStr = processorIdStr;
 this.zkUtils = zkUtils;
 this.keyBuilder = zkUtils.getKeyBuilder();
 this.hostName = getHostName();
 this.previousProcessorChangeListener = new PreviousProcessorChangeListener(zkUtils);
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath()});
}

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

@Test
public void testProcessorsPath() {
 ZkKeyBuilder builder = new ZkKeyBuilder("test");
 Assert.assertEquals("/test/" + ZkKeyBuilder.PROCESSORS_PATH, builder.getProcessorsPath());
}

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

@Test
public void testRegisterProcessorId() {
 String assignedPath = zkUtils.registerProcessorAndGetId(new ProcessorData("host", "1"));
 Assert.assertTrue(assignedPath.startsWith(KEY_BUILDER.getProcessorsPath()));
 // Calling registerProcessorId again should return the same ephemeralPath as long as the session is valid
 Assert.assertTrue(zkUtils.registerProcessorAndGetId(new ProcessorData("host", "1")).equals(assignedPath));
}

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

@Override
public void start() {
 ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
 zkUtils.validateZkVersion();
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder.getJobModelPathPrefix(), keyBuilder.getTaskLocalityPath()});
 systemAdmins.start();
 leaderElector.tryBecomeLeader();
 zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}

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

@Override
public void start() {
 ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
 zkUtils.validateZkVersion();
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
   .getJobModelPathPrefix()});
 startMetrics();
 systemAdmins.start();
 leaderElector.tryBecomeLeader();
 zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}

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

@Override
public void start() {
 ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
 zkUtils.validateZkVersion();
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
   .getJobModelPathPrefix()});
 startMetrics();
 systemAdmins.start();
 leaderElector.tryBecomeLeader();
 zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}

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

@Override
public void start() {
 ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
 zkUtils.validateZkVersion();
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
   .getJobModelPathPrefix()});
 startMetrics();
 systemAdmins.start();
 leaderElector.tryBecomeLeader();
 zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}

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

@Override
public void start() {
 ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
 zkUtils.validateZkVersion();
 zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
   .getJobModelPathPrefix()});
 startMetrics();
 systemAdmins.start();
 leaderElector.tryBecomeLeader();
 zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}

相关文章