Example #1
0
  @Override
  protected void doStop() throws Exception {
    if (managedClient) {
      client.close();
    }

    super.doStop();
  }
Example #2
0
  private void watch() throws Exception {
    if (isRunAllowed()) {
      if (leader.get()) {
        setIndex(client.refresh(servicePath, ttl).send().get());
      }

      LOGGER.debug(
          "Watch (path={}, isLeader={}, index={})", servicePath, leader.get(), index.get());

      client
          .get(servicePath)
          .waitForChange(index.get())
          .timeout(ttl / 3, TimeUnit.SECONDS)
          .send()
          .addListener(this);
    }
  }
  @Override
  protected void doStop() throws Exception {
    if (client != null) {
      client.close();
    }

    super.doStop();
  }