Package org.springframework.retry.support

Examples of org.springframework.retry.support.RetrySimulation$SleepSequence


  @Test
   public void testSingleBackoff() throws Exception {
        ExponentialBackOffPolicy backOffPolicy = makeBackoffPolicy();
        RetrySimulator simulator = new RetrySimulator(backOffPolicy, makeRetryPolicy());
        RetrySimulation simulation = simulator.executeSimulation(1);

        List<Long> sleeps = simulation.getLongestTotalSleepSequence().getSleeps();
        System.out.println("Single trial of " + backOffPolicy + ": sleeps=" + sleeps);
        assertEquals(MAX_RETRIES - 1, sleeps.size());
        long initialInterval = backOffPolicy.getInitialInterval();
        for (int i=0; i<sleeps.size(); i++) {
            long expectedMaxValue = 2*(long) (initialInterval + initialInterval * Math.max(1, Math.pow(backOffPolicy.getMultiplier(), i)));
View Full Code Here


  @Test
  public void testMultiBackOff() throws Exception {
        ExponentialBackOffPolicy backOffPolicy = makeBackoffPolicy();
        RetrySimulator simulator = new RetrySimulator(backOffPolicy, makeRetryPolicy());
        RetrySimulation simulation = simulator.executeSimulation(NUM_TRIALS);

        System.out.println("Ran " + NUM_TRIALS + " backoff trials.  Each trial retried " + MAX_RETRIES + " times");
        System.out.println("Policy: " + backOffPolicy);
        System.out.println("All generated backoffs:");
        System.out.println("    " + simulation.getPercentiles());

        System.out.println("Backoff frequencies:");
        System.out.print("    " + simulation.getPercentiles());

  }
View Full Code Here

TOP

Related Classes of org.springframework.retry.support.RetrySimulation$SleepSequence

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.