gpt4 book ai didi

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

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

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

ZooKeeperClient.getData介绍

暂无

代码示例

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

@Override
public byte[] getData(String path) throws KeeperException {
 return reporter.time(tag, "getData", () -> client.getData(path));
}

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

private <T> T tryGetEntity(final ZooKeeperClient client, String path, TypeReference<T> type,
              String name) {
 try {
  final byte[] data = client.getData(path);
  return Json.read(data, type);
 } catch (NoNodeException e) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("reading " + name + " info failed", e);
 }
}

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

@Nullable
private TaskStatus getTaskStatus(final ZooKeeperClient client, final String host,
                 final JobId jobId) {
 final String containerPath = Paths.statusHostJob(host, jobId);
 try {
  final byte[] data = client.getData(containerPath);
  return parse(data, TaskStatus.class);
 } catch (NoNodeException ignored) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("Getting task " + jobId + " status "
                   + "for host " + host + " failed", e);
 }
}

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

private Job getJob(final ZooKeeperClient client, final JobId id) {
 final String path = Paths.configJob(id);
 try {
  final byte[] data = client.getData(path);
  return Json.read(data, Job.class);
 } catch (NoNodeException e) {
  // Return null to indicate that the job does not exist
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting job " + id + " failed", e);
 }
}

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

private void assertHostExists(final ZooKeeperClient client, final String host)
  throws HostNotFoundException {
 try {
  client.getData(Paths.configHost(host));
 } catch (NoNodeException e) {
  throw new HostNotFoundException(host, e);
 } catch (KeeperException e) {
  throw new HeliosRuntimeException(e);
 }
}

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

private void assertTaskExists(final ZooKeeperClient client, final String host, final JobId jobId)
  throws JobNotDeployedException {
 try {
  client.getData(Paths.configHostJob(host, jobId));
 } catch (NoNodeException e) {
  throw new JobNotDeployedException(host, jobId);
 } catch (KeeperException e) {
  throw new HeliosRuntimeException(e);
 }
}

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

for (final String node : nodes) {
 final String nodePath = ZKPaths.makePath(path, node);
 final byte[] data = client.getData(nodePath);
 remote.put(node, data);

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

private DeploymentGroup getDeploymentGroup(final ZooKeeperClient client, final String name)
  throws DeploymentGroupDoesNotExistException {
 try {
  final byte[] data = client.getData(Paths.configDeploymentGroup(name));
  return Json.read(data, DeploymentGroup.class);
 } catch (NoNodeException e) {
  throw new DeploymentGroupDoesNotExistException(name);
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment-group " + name + " failed", e);
 }
}

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

final byte[] data = client.getData(Paths.historyJobHostEventsTimestamp(
  jobId, h, Long.valueOf(event)));
final TaskStatus status = Json.read(data, TaskStatus.class);

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

final String path = Paths.configDeploymentGroup(name);
try {
 final byte[] data = client.getData(path);
 final DeploymentGroup descriptor = parse(data, DeploymentGroup.class);
 descriptors.put(descriptor.getName(), descriptor);

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

final String path = Paths.configJob(jobId);
try {
 final byte[] data = client.getData(path);
 final Job descriptor = parse(data, Job.class);
 descriptors.put(descriptor.getId(), descriptor);

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

ZooKeeperRegistrarUtil.registerHost(client, idPath, name, id);
} else {
 final byte[] bytes = client.getData(idPath);
 final String existingId = bytes == null ? "" : new String(bytes, UTF_8);
 if (!id.equals(existingId)) {

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

private Map<JobId, Deployment> getTasks(final ZooKeeperClient client, final String host) {
 final Map<JobId, Deployment> jobs = Maps.newHashMap();
 try {
  final String folder = Paths.configHostJobs(host);
  final List<String> jobIds;
  try {
   jobIds = client.getChildren(folder);
  } catch (KeeperException.NoNodeException e) {
   log.warn("Unable to get deployment config for {}", host, e);
   return ImmutableMap.of();
  }
  for (final String jobIdString : jobIds) {
   final JobId jobId = JobId.fromString(jobIdString);
   final String containerPath = Paths.configHostJob(host, jobId);
   try {
    final byte[] data = client.getData(containerPath);
    final Task task = parse(data, Task.class);
    jobs.put(jobId, Deployment.of(jobId, task.getGoal(), task.getDeployerUser(),
      task.getDeployerMaster(), task.getDeploymentGroupName()));
   } catch (KeeperException.NoNodeException ignored) {
    log.debug("deployment config node disappeared: {}", jobIdString);
   }
  }
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment config failed", e);
 }
 return jobs;
}

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

private static void checkForPortConflicts(final ZooKeeperClient client,
                     final String host,
                     final int port,
                     final JobId jobId)
  throws JobPortAllocationConflictException {
 try {
  final String path = Paths.configHostPort(host, port);
  if (client.stat(path) == null) {
   return;
  }
  final byte[] b = client.getData(path);
  final JobId existingJobId = parse(b, JobId.class);
  throw new JobPortAllocationConflictException(jobId, existingJobId, host, port);
 } catch (KeeperException | IOException ex) {
  throw new HeliosRuntimeException("checking port allocations failed", ex);
 }
}

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

/**
 * Returns the current deployment state of {@code jobId} on {@code host}.
 */
@Override
public Deployment getDeployment(final String host, final JobId jobId) {
 final String path = Paths.configHostJob(host, jobId);
 final ZooKeeperClient client = provider.get("getDeployment");
 try {
  final byte[] data = client.getData(path);
  final Task task = parse(data, Task.class);
  return Deployment.of(jobId, task.getGoal(), task.getDeployerUser(), task.getDeployerMaster(),
    task.getDeploymentGroupName());
 } catch (KeeperException.NoNodeException e) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment failed", e);
 }
}

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

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

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

private <T> T tryGetEntity(final ZooKeeperClient client, String path, TypeReference<T> type,
              String name) {
 try {
  final byte[] data = client.getData(path);
  return Json.read(data, type);
 } catch (NoNodeException e) {
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("reading " + name + " info failed", e);
 }
}

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

private void assertHostExists(final ZooKeeperClient client, final String host)
throws HostNotFoundException {
 try {
  client.getData(Paths.configHost(host));
 } catch (NoNodeException e) {
  throw new HostNotFoundException(host, e);
 } catch (KeeperException e) {
  throw new HeliosRuntimeException(e);
 }
}

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

private Job getJob(final ZooKeeperClient client, final JobId id) {
 final String path = Paths.configJob(id);
 try {
  final byte[] data = client.getData(path);
  return Json.read(data, Job.class);
 } catch (NoNodeException e) {
  // Return null to indicate that the job does not exist
  return null;
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting job " + id + " failed", e);
 }
}

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

private DeploymentGroup getDeploymentGroup(final ZooKeeperClient client, final String name)
  throws DeploymentGroupDoesNotExistException {
 try {
  final byte[] data = client.getData(Paths.configDeploymentGroup(name));
  return Json.read(data, DeploymentGroup.class);
 } catch (NoNodeException e) {
  throw new DeploymentGroupDoesNotExistException(name);
 } catch (KeeperException | IOException e) {
  throw new HeliosRuntimeException("getting deployment-group " + name + " failed", e);
 }
}

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