Examples of ExponentialBackoffPolicy


Examples of org.springframework.retry.backoff.ExponentialBackOffPolicy

  @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

Examples of org.springframework.retry.backoff.ExponentialBackOffPolicy

   * @return this.
   */
  public RetryInterceptorBuilder<T> backOffOptions(long initialInterval, double multiplier , long maxInterval) {
    Assert.isNull(this.retryOperations, "cannot set the back off policy when a custom retryOperations has been set");
    Assert.isTrue(!this.backOffPolicySet, "cannot set the back off options when a back off policy has been set");
    ExponentialBackOffPolicy policy = new ExponentialBackOffPolicy();
    policy.setInitialInterval(initialInterval);
    policy.setMultiplier(multiplier);
    policy.setMaxInterval(maxInterval);
    this.retryTemplate.setBackOffPolicy(policy);
    this.backOffOptionsSet = true;
    this.templateAltered = true;
    return this;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.