Package com.spotify.helios.agent

Examples of com.spotify.helios.agent.RetryScheduler


  private class Update implements Reactor.Callback {

    @Override
    public void run(final boolean timeout) throws InterruptedException {
      final RetryScheduler retryScheduler = retryIntervalPolicy.newScheduler();
      while (isAlive()) {
        try {
          eventListener.tryToRegister(client);
          return;
        } catch (KeeperException e) {
          final long sleep = retryScheduler.nextMillis();
          if (e instanceof ConnectionLossException) {
            log.warn("ZooKeeper connection lost, retrying registration in {} ms", sleep);
          } else {
            log.error("ZooKeeper registration failed, retrying in {} ms", sleep, e);
          }
View Full Code Here


        .setMaxInterval(30, SECONDS)
        .build();

    @Override
    public void run(final boolean timeout) throws InterruptedException {
      final RetryScheduler retryScheduler = retryIntervalPolicy.newScheduler();
      while (isAlive()) {
        try {
          update();
          return;
        } catch (KeeperException e) {
          synced = false;
          log.warn("update failed: {}", e.getMessage());
          Thread.sleep(retryScheduler.nextMillis());
        }
      }
    }
View Full Code Here

  private class Update implements Reactor.Callback {

    @Override
    public void run(final boolean timeout) throws InterruptedException {
      final RetryScheduler retryScheduler = BoundedRandomExponentialBackoff.newBuilder()
          .setMinInterval(1, SECONDS)
          .setMaxInterval(30, SECONDS)
          .build()
          .newScheduler();

      while (isAlive()) {
        try {
          if (!parentExists()) {
            log.warn("parent does not exist: {}", path);
            return;
          }
          if (!initialized) {
            syncChecked();
            initialized = true;
          }
          incrementalUpdate();
          return;
        } catch (KeeperException e) {
          final long backoff = retryScheduler.nextMillis();
          initialized = false;
          if (e instanceof ConnectionLossException) {
            log.warn("Connection lost. Resyncing in {}ms", backoff);
          } else if (e instanceof NodeExistsException || e instanceof NoNodeException) {
            log.warn("Conflict: {} {}. Resyncing in {}ms", e.getPath(), e.code(), backoff);
View Full Code Here

TOP

Related Classes of com.spotify.helios.agent.RetryScheduler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.