gpt4 book ai didi

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

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

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

ZooKeeperClient.delete介绍

暂无

代码示例

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

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

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

@Override
public void delete(String path, int version) throws KeeperException {
 reporter.time(tag, "delete", () -> {
  client.delete(path, version);
  return null;
 });
}

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

private void delete(final String node) throws KeeperException {
 final ZooKeeperClient client = client("delete");
 final String nodePath = ZKPaths.makePath(path, node);
 if (client.stat(nodePath) != null) {
  log.debug("deleting node: {}", nodePath);
  client.delete(nodePath);
 }
}

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

private void trimStatusEvents(List<String> events, JobId jobId) {
  // CleanupExecutor only has one thread so can assume no others are fiddling as we do this.
  // All this to sort numerically instead of lexically....
  final List<Long> eventsAsLongs = Lists.newArrayList(
    Iterables.transform(events, new Function<String, Long>() {
     @Override
     public Long apply(String name) {
      return Long.valueOf(name);
     }
    }));
  Collections.sort(eventsAsLongs);

  for (int i = 0; i < (eventsAsLongs.size() - MAX_NUMBER_STATUS_EVENTS_TO_RETAIN); i++) {
   try {
    client.delete(Paths.historyJobHostEventsTimestamp(jobId, hostname, eventsAsLongs.get(i)));
   } catch (KeeperException e) {
    log.warn("failure deleting overflow of status items - we're hoping a later"
         + " execution will fix", e);
   }
  }
 }
}

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

final String nodePath = ZKPaths.makePath(path, node);
log.debug("sync: deleting node {}", nodePath);
client.delete(nodePath);
remote.remove(node);

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

@Test
public void testZooKeeperClient() throws Exception {
 // Create the cluster ID node
 zk().curatorWithSuperAuth().newNamespaceAwareEnsurePath(Paths.configId(zkClusterId))
   .ensure(zk().curatorWithSuperAuth().getZookeeperClient());
 // We need to create a new curator because ZooKeeperClient will try to start it,
 // and zk().curator() has already been started.
 final ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3);
 final CuratorFramework curator = CuratorFrameworkFactory.builder()
   .retryPolicy(retryPolicy)
   .connectString(zk().connectString())
   .build();
 final ZooKeeperClient client = new DefaultZooKeeperClient(curator, zkClusterId);
 client.start();
 // This should work since the cluster ID exists
 client.create("/test");
 // Now let's remove the cluster ID
 client.delete(Paths.configId(zkClusterId));
 // Sleep so the watcher thread in ZooKeeperClient has a chance to update state
 Thread.sleep(500);
 // Try the same operation again, and it should fail this time
 try {
  client.ensurePath(Paths.configJobs());
  fail("ZooKeeper operation should have failed because cluster ID was removed");
 } catch (IllegalStateException ignore) {
  // ignored
 }
}

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

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

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

@Override
public void delete(String path, int version) throws KeeperException {
 try {
  client.delete(path, version);
 } catch (KeeperException e) {
  reporter.checkException(e, tag, "delete");
  throw e;
 }
}

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

private void delete(final String node) throws KeeperException {
 final ZooKeeperClient client = client("delete");
 final String nodePath = ZKPaths.makePath(path, node);
  if (client.stat(nodePath) != null) {
   log.debug("deleting node: {}", nodePath);
   client.delete(nodePath);
  }
}

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

private void trimStatusEvents(final List<String> events, final String eventsPath) {
  // All this to sort numerically instead of lexically....
  final List<Long> eventsAsLongs = Lists.newArrayList(Iterables.transform(events,
   new Function<String, Long>() {
   @Override
   public Long apply(String name) {
    return Long.valueOf(name);
   }
  }));
  Collections.sort(eventsAsLongs);

  for (int i = 0; i < (eventsAsLongs.size() - getMaxEventsPerPath()); i++) {
   try {
    client.delete(getZkEventPath(eventsPath, eventsAsLongs.get(i)));
   } catch (KeeperException e) {
    log.warn("failure deleting overflow of status events - we're hoping a later"
      + " execution will fix", e);
   }
  }
 }
}

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

final String nodePath = ZKPaths.makePath(path, node);
log.debug("sync: deleting node {}", nodePath);
client.delete(nodePath);
remote.remove(node);

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

@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);
 }
}

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