All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.univapay.sdk.utils.ExponentialBackoffSleeper Maven / Gradle / Ivy

There is a newer version: 0.2.35
Show newest version
package com.univapay.sdk.utils;

public class ExponentialBackoffSleeper implements Sleeper {

  private final Backoff backoff;

  public ExponentialBackoffSleeper(
      long initialIntervalMillis,
      long maxIntervalMillis,
      double multiplier,
      double randomizationFactor) {
    this.backoff =
        new ExponentialBackoff(
            initialIntervalMillis, maxIntervalMillis, multiplier, randomizationFactor);
  }

  @Override
  public void reset() {
    backoff.reset();
  }

  @Override
  public void sleep() throws InterruptedException {
    Thread.sleep(backoff.next());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy