private boolean parentExists() throws KeeperException { return client("parentExists").exists(path) != null; }
@Override public Stat exists(String path) throws KeeperException { return reporter.time(tag, "exists", () -> client.exists(path)); }
private boolean checkHostUp(final ZooKeeperClient client, final String host) { try { final Stat stat = client.exists(Paths.statusHostUp(host)); return stat != null; } catch (KeeperException e) { throw new HeliosRuntimeException("getting host " + host + " up status failed", e); } }
public static boolean isHostRegistered(final ZooKeeperClient client, final String host) { try { final Stat stat = client.exists(Paths.configHostId(host)); return stat != null; } catch (KeeperException e) { throw new HeliosRuntimeException("getting host " + host + " id failed", e); } }
/** * Returns a list of the host names of the currently running masters. */ @Override public List<String> getRunningMasters() { final ZooKeeperClient client = provider.get("getRunningMasters"); try { final List<String> masters = client.getChildren(Paths.statusMaster()); final ImmutableList.Builder<String> upMasters = ImmutableList.builder(); for (final String master : masters) { if (client.exists(Paths.statusMasterUp(master)) != null) { upMasters.add(master); } } return upMasters.build(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing masters failed", e); } }
final String hostInfoPath = Paths.statusHostInfo(name); final Stat stat = client.exists(idPath); if (stat == null) { log.debug("Agent id node not present, registering agent {}: {}", id, name);
final List<ZooKeeperOperation> operations = Lists.newArrayList(); if (client.exists(Paths.configHost(host)) == null) { throw new HostNotFoundException("host [" + host + "] does not exist"); operations.add(delete(node)); if (client.exists(Paths.configJobHost(job, host)) != null) { operations.add(delete(Paths.configJobHost(job, host))); if (client.exists(idPath) != null) { operations.add(delete(idPath));
final Stat tasksStat = client.exists(tasksPath); if (tasksStat != null) { operations.add(delete(tasksPath));
if (client.exists(path) == null) { operations.add(create(path));
events.add(eventFactory.rollingUpdateStarted(deploymentGroup)); final Stat tasksStat = client.exists( Paths.statusDeploymentGroupTasks(deploymentGroup.getName())); if (tasksStat == null) {
if (client.exists(creationPath) != null) {
if (client.exists(taskCreationPath) != null) {
private boolean parentExists() throws KeeperException { return client("parentExists").exists(path) != null; }
@Override public Stat exists(String path) throws KeeperException { try { return client.exists(path); } catch (KeeperException e) { reporter.checkException(e, tag, "exists"); throw e; } }
private boolean checkHostUp(final ZooKeeperClient client, final String host) { try { final Stat stat = client.exists(Paths.statusHostUp(host)); return stat != null; } catch (KeeperException e) { throw new HeliosRuntimeException("getting host " + host + " up status failed", e); } }
/** * Returns a list of the host names of the currently running masters. */ @Override public List<String> getRunningMasters() { final ZooKeeperClient client = provider.get("getRunningMasters"); try { final List<String> masters = client.getChildren(Paths.statusMaster()); final ImmutableList.Builder<String> upMasters = ImmutableList.builder(); for (final String master : masters) { if (client.exists(Paths.statusMasterUp(master)) != null) { upMasters.add(master); } } return upMasters.build(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing masters failed", e); } }
@Override public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.delete(Paths.configDeploymentGroup(name)); if (client.exists(Paths.statusDeploymentGroupHosts(name)) != null) { client.delete(Paths.statusDeploymentGroupHosts(name)); } if (client.exists(Paths.statusDeploymentGroup(name)) != null) { client.delete(Paths.statusDeploymentGroup(name)); } } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }
final String idPath = Paths.configHostId(name); final Stat stat = client.exists(idPath); if (stat == null) { log.debug("Agent id node not present, registering agent {}: {}", id, name);
if (client.exists(creationPath) != null) {
stat = client.exists(Paths.configHostId(host)); } catch (KeeperException e) { throw new HeliosRuntimeException("Failed to check host status", e);