Package org.springframework.retry.backoff

Examples of org.springframework.retry.backoff.ExponentialRandomBackOffPolicy$ExponentialRandomBackOffContext


    long min = backoff.delay() == 0 ? backoff.value() : backoff.delay();
    long max = backoff.maxDelay();
    if (backoff.multiplier() > 0) {
      ExponentialBackOffPolicy policy = new ExponentialBackOffPolicy();
      if (backoff.random()) {
        policy = new ExponentialRandomBackOffPolicy();
      }
      policy.setInitialInterval(min);
      policy.setMultiplier(backoff.multiplier());
      policy.setMaxInterval(max > min ? max : ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL);
      if (sleeper != null) {
View Full Code Here


  @Test
  public void testSimulatorExercisesRandomExponentialBackoff() {
    SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
    retryPolicy.setMaxAttempts(5);

    ExponentialBackOffPolicy backOffPolicy = new ExponentialRandomBackOffPolicy();
    backOffPolicy.setMultiplier(2);
    backOffPolicy.setMaxInterval(30000);
    backOffPolicy.setInitialInterval(100);

    RetrySimulator simulator = new RetrySimulator(backOffPolicy, retryPolicy);
    RetrySimulation simulation = simulator.executeSimulation(10000);
    System.out.println(backOffPolicy);
    System.out.println("Longest sequence  " + simulation.getLongestTotalSleepSequence());
View Full Code Here

TOP

Related Classes of org.springframework.retry.backoff.ExponentialRandomBackOffPolicy$ExponentialRandomBackOffContext

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.