gpt4 book ai didi

com.spotify.helios.servicescommon.coordination.ZooKeeperClient.getNode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 04:11:31 26 4
gpt4 key购买 nike

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

ZooKeeperClient.getNode介绍

暂无

代码示例

代码示例来源:origin: spotify/helios

@Override
public Node getNode(String path) throws KeeperException {
 return reporter.time(tag, "getNode", () -> client.getNode(path));
}

代码示例来源:origin: spotify/helios

private List<String> getHosts(final ZooKeeperClient client, final String path) {
 try {
  return Json.read(client.getNode(path).getBytes(), STRING_LIST_TYPE);
 } catch (JsonMappingException | JsonParseException | NoNodeException e) {
  return emptyList();
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("failed to read deployment group hosts from " + path, e);
 }
}

代码示例来源:origin: spotify/helios

final String path = Paths.statusDeploymentGroupTasks(name);
try {
 final Node node = client.getNode(path);
 final byte[] data = node.getBytes();
 final int version = node.getStat().getVersion();

代码示例来源:origin: spotify/helios

@Override
public DeploymentGroupStatus getDeploymentGroupStatus(final String name)
  throws DeploymentGroupDoesNotExistException {
 log.debug("getting deployment group status: {}", name);
 final ZooKeeperClient client = provider.get("getDeploymentGroupStatus");
 final DeploymentGroup deploymentGroup = getDeploymentGroup(client, name);
 if (deploymentGroup == null) {
  return null;
 }
 try {
  final Node node = client.getNode(Paths.statusDeploymentGroup(name));
  final byte[] bytes = node.getBytes();
  if (bytes.length == 0) {
   return null;
  }
  return Json.read(bytes, DeploymentGroupStatus.class);
 } catch (NoNodeException e) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment group status " + name + " failed", e);
 }
}

代码示例来源:origin: spotify/helios

private boolean isRolloutTimedOut(final ZooKeeperClient client,
                 final DeploymentGroup deploymentGroup) {
 final String groupName = deploymentGroup.getName();
 final RolloutOptions defaultOptions = RolloutOptions.getDefault();
 final long groupTimeoutSetting =
   deploymentGroup.getRolloutOptions() == null
   ? defaultOptions.getTimeout()
   : deploymentGroup.getRolloutOptions().withFallback(defaultOptions).getTimeout();
 final long secondsSinceDeploy;
 try {
  final String statusPath = Paths.statusDeploymentGroupTasks(groupName);
  secondsSinceDeploy = MILLISECONDS.toSeconds(
    System.currentTimeMillis() - client.getNode(statusPath).getStat().getMtime());
 } catch (KeeperException e) {
  // statusPath doesn't exist or some other ZK issue. probably this deployment group
  // was removed.
  log.warn("error determining deployment group modification time: name={}", groupName, e);
  return false;
 }
 if (secondsSinceDeploy > groupTimeoutSetting) {
  log.info("rolling-update on deployment-group name={} has timed out after "
       + "{} seconds (rolloutOptions.timeout={})",
    groupName, secondsSinceDeploy, groupTimeoutSetting);
  return true;
 }
 return false;
}

代码示例来源:origin: spotify/helios

client.getNode(taskPath);

代码示例来源:origin: spotify/helios

ops.add(set(Paths.statusDeploymentGroupRemovedHosts(groupName), Json.asBytes(removedHosts)));
final Node dgn = client.getNode(Paths.configDeploymentGroup(groupName));
final Integer deploymentGroupVersion = dgn.getStat().getVersion();
DeploymentGroup deploymentGroup = Json.read(dgn.getBytes(), DeploymentGroup.class);

代码示例来源:origin: spotify/helios

final String host) {
try {
 final Node node = client.getNode(
   Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()));
 final int version = node.getStat().getVersion();

代码示例来源:origin: spotify/helios

client.getNode(taskPath);

代码示例来源:origin: at.molindo/helios-services

@Override
public Node getNode(String path) throws KeeperException {
 try {
  return client.getNode(path);
 } catch (KeeperException e) {
  reporter.checkException(e, tag, "getNode");
  throw e;
 }
}

代码示例来源:origin: at.molindo/helios-services

private boolean isRolloutTimedOut(final DeploymentGroup deploymentGroup,
                 final ZooKeeperClient client) {
 try {
  final String statusPath = Paths.statusDeploymentGroup(deploymentGroup.getName());
  final long secondsSinceDeploy = MILLISECONDS.toSeconds(
    System.currentTimeMillis() - client.getNode(statusPath).getStat().getMtime());
  return secondsSinceDeploy > deploymentGroup.getRolloutOptions().getTimeout();
 } catch (KeeperException e) {
  // statusPath doesn't exist or some other ZK issue. probably this deployment group
  // was removed.
  log.warn("error determining deployment group modification time: {} - {}",
       deploymentGroup.getName(), e);
  return false;
 }
}

代码示例来源:origin: at.molindo/helios-services

@Override
public DeploymentGroupStatus getDeploymentGroupStatus(final String name)
  throws DeploymentGroupDoesNotExistException {
 log.debug("getting deployment group status: {}", name);
 final ZooKeeperClient client = provider.get("getDeploymentGroupStatus");
 final DeploymentGroup deploymentGroup = getDeploymentGroup(client, name);
 if (deploymentGroup == null) {
  return null;
 }
 try {
  final Node node = client.getNode(Paths.statusDeploymentGroup(name));
  final byte[] bytes = node.getBytes();
  if (bytes.length == 0) {
   return null;
  }
  final DeploymentGroupStatus status = Json.read(bytes, DeploymentGroupStatus.class);
  return status.toBuilder()
    .setVersion(node.getStat().getVersion())
    .build();
 } catch (NoNodeException e) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment group status " + name + " failed", e);
 }
}

代码示例来源:origin: at.molindo/helios-services

client.getNode(taskPath);

代码示例来源:origin: at.molindo/helios-services

client.getNode(taskPath);

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