/** * Creates a new TruncatedBinaryBackoff that will start by backing off for {@code initialBackoff} * and then backoff of twice as long each time its called until reaching the {@code maxBackoff} at * which point shouldContinue() will return false and any future backoffs will always wait for * that amount of time. * * @param initialBackoff the intial amount of time to backoff * @param maxBackoff the maximum amount of time to backoff * @param stopAtMax whether shouldContinue() returns false when the max is reached */ public TruncatedBinaryBackoff(Duration initialBackoff, Duration maxBackoff, boolean stopAtMax) { Objects.requireNonNull(initialBackoff); Objects.requireNonNull(maxBackoff); if (initialBackoff.inMillis() <= 0) { throw new IllegalArgumentException(); } if (maxBackoff.compareTo(initialBackoff) < 0) { throw new IllegalArgumentException(); } initialBackoffMs = initialBackoff.inMillis(); maxBackoffIntervalMs = maxBackoff.inMillis(); this.stopAtMax = stopAtMax; }
/** * Creates a new TruncatedBinaryBackoff that will start by backing off for {@code initialBackoff} * and then backoff of twice as long each time its called until reaching the {@code maxBackoff} at * which point shouldContinue() will return false and any future backoffs will always wait for * that amount of time. * * @param initialBackoff the intial amount of time to backoff * @param maxBackoff the maximum amount of time to backoff * @param stopAtMax whether shouldContinue() returns false when the max is reached */ public TruncatedBinaryBackoff(Duration initialBackoff, Duration maxBackoff, boolean stopAtMax) { Objects.requireNonNull(initialBackoff); Objects.requireNonNull(maxBackoff); if (initialBackoff.inMillis() <= 0) { throw new IllegalArgumentException(); } if (maxBackoff.compareTo(initialBackoff) < 0) { throw new IllegalArgumentException(); } initialBackoffMs = initialBackoff.inMillis(); maxBackoffIntervalMs = maxBackoff.inMillis(); this.stopAtMax = stopAtMax; }
Optional<String> chrootPath, Iterable<InetSocketAddress> zooKeeperServers) { this.sessionTimeoutMs = (int) Objects.requireNonNull(sessionTimeout).inMillis(); this.credentials = Objects.requireNonNull(credentials);
Optional<String> chrootPath, Iterable<InetSocketAddress> zooKeeperServers) { this.sessionTimeoutMs = (int) Objects.requireNonNull(sessionTimeout).inMillis(); this.credentials = Objects.requireNonNull(credentials);