gpt4 book ai didi

com.spotify.helios.servicescommon.coordination.ZooKeeperModelReporter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:08:36 27 4
gpt4 key购买 nike

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

ZooKeeperModelReporter介绍

暂无

代码示例

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

public static ZooKeeperModelReporter noop() {
 return new ZooKeeperModelReporter(new NoopZooKeeperMetrics());
}

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

public <T> T time(final String tag, final String name, ZooKeeperCallable<T> callable)
  throws KeeperException {
 final long startTime = clock.getTick();
 try {
  return callable.call();
 } catch (KeeperException e) {
  checkException(e, tag, name);
  throw e;
 } catch (Exception e) {
  Throwables.throwIfUnchecked(e);
  throw new RuntimeException(e);
 } finally {
  metrics.updateTimer(name, clock.getTick() - startTime, TimeUnit.NANOSECONDS);
 }
}

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

@Override
public void start() {
 client.start();
 client.getConnectionStateListenable().addListener(
   (client, newState) -> reporter.connectionStateChanged(newState));
}

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

@Override
public ZooKeeper.States getState() throws KeeperException {
 return reporter.time(tag, "getState", client::getState);
}

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

@Before
public void setUp() throws Exception {
 // make zookeeper interfaces
 curator = zk().curatorWithSuperAuth();
 final ZooKeeperClientProvider zkcp = new ZooKeeperClientProvider(
   new DefaultZooKeeperClient(curator), ZooKeeperModelReporter.noop());
 final List<EventSender> eventSenders = Collections.emptyList();
 zkMasterModel = new ZooKeeperMasterModel(zkcp, getClass().getName(), eventSenders, "");
 startDefaultMaster();
 agent = startDefaultAgent(TEST_HOST);
 client = defaultClient();
 awaitHostRegistered(client, TEST_HOST, LONG_WAIT_SECONDS, SECONDS);
}

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

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

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

@Test
 public void testRemoveJobDeletesHistory() throws Exception {
  startDefaultAgent(testHost());
  awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS);

  final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND);

  deployJob(jobId, testHost());
  awaitJobState(
    defaultClient(), testHost(), jobId, TaskStatus.State.RUNNING, LONG_WAIT_SECONDS, SECONDS);
  undeployJob(jobId, testHost());
  awaitJobUndeployed(defaultClient(), testHost(), jobId, LONG_WAIT_SECONDS, SECONDS);

  final ZooKeeperClient zkClient = new ZooKeeperClientProvider(
    new DefaultZooKeeperClient(zk().curatorWithSuperAuth()), ZooKeeperModelReporter.noop())
    .get("test-client");

  // Check that there's some history events
  assertNotNull(zkClient.stat(Paths.historyJob(jobId)));

  // Remove job
  final JobDeleteResponse response =
    defaultClient().deleteJob(jobId).get(WAIT_TIMEOUT_SECONDS, SECONDS);
  assertEquals(JobDeleteResponse.Status.OK, response.getStatus());

  // Verify that history is gone
  assertNull(zkClient.stat(Paths.historyJob(jobId)));
 }
}

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

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

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

new ZooKeeperModelReporter(metrics.getZooKeeperMetrics());
final ZooKeeperClientProvider zkClientProvider = new ZooKeeperClientProvider(
  zooKeeperClient, modelReporter);

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

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

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

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

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

new ZooKeeperModelReporter(metrics.getZooKeeperMetrics());
final ZooKeeperClientProvider zkClientProvider = new ZooKeeperClientProvider(
  zooKeeperClient, modelReporter);

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

@Override
public Collection<CuratorTransactionResult> transaction(ZooKeeperOperation... operations)
  throws KeeperException {
 return reporter.time(tag, "transaction", () -> client.transaction(operations));
}

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

@Override
public ZooKeeper.States getState() throws KeeperException {
 try {
  return client.getState();
 } catch (KeeperException e) {
  reporter.checkException(e, tag, "getDeploymentGroupStatus");
  throw e;
 }
}

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

public static ZooKeeperModelReporter noop() {
  return new ZooKeeperModelReporter(new NoOpRiemannClient().facade(), new NoopZooKeeperMetrics());
 }
}

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

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

代码示例来源: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

new ZooKeeperModelReporter(riemannFacade, metrics.getZooKeeperMetrics());
final ZooKeeperClientProvider zkClientProvider = new ZooKeeperClientProvider(
  zooKeeperClient, modelReporter);

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

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

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

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

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