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

jp.gopay.sdk.utils.ExponentialBackoffSleeper Maven / Gradle / Ivy

There is a newer version: 0.11.17
Show newest version
package jp.gopay.sdk.utils;

public class ExponentialBackoffSleeper implements Sleeper {

    final private 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 - 2024 Weber Informatics LLC | Privacy Policy