Examples of ExponentialBackoff


Examples of org.objectweb.celtix.ws.rm.policy.RMAssertionType.ExponentialBackoff

        rma = RMUtils.getWSRMPolicyFactory().createRMAssertionType();
        BaseRetransmissionInterval bri =
            RMUtils.getWSRMPolicyFactory().createRMAssertionTypeBaseRetransmissionInterval();
        bri.setMilliseconds(new BigInteger("3000"));
        rma.setBaseRetransmissionInterval(bri);
        ExponentialBackoff eb =
            RMUtils.getWSRMPolicyFactory().createRMAssertionTypeExponentialBackoff();
        eb.getOtherAttributes().put(RetransmissionQueue.EXPONENTIAL_BACKOFF_BASE_ATTR,
                                    RetransmissionQueue.DEFAULT_EXPONENTIAL_BACKOFF);
       
    }
View Full Code Here

Examples of org.objectweb.celtix.ws.rm.policy.RMAssertionType.ExponentialBackoff

            bri.setMilliseconds(new BigInteger(RetransmissionQueue.DEFAULT_BASE_RETRANSMISSION_INTERVAL));
            a.setBaseRetransmissionInterval(bri);
        }
       
        if (null == a.getExponentialBackoff()) {
            ExponentialBackoff eb  =
                RMUtils.getWSRMPolicyFactory().createRMAssertionTypeExponentialBackoff();
            a.setExponentialBackoff(eb);
        }
        Map<QName, String> otherAttributes = a.getExponentialBackoff().getOtherAttributes();
        String val = otherAttributes.get(RetransmissionQueue.EXPONENTIAL_BACKOFF_BASE_ATTR);
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

  @Rule
  public final ExpectedException thrown = ExpectedException.none();

  @Test
  public void defaultInstance() {
    ExponentialBackOff backOff = new ExponentialBackOff();
    BackOffExecution execution = backOff.start();
    assertEquals(2000l, execution.nextBackOff());
    assertEquals(3000l, execution.nextBackOff());
    assertEquals(4500l, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(4500l, execution.nextBackOff());
  }

  @Test
  public void simpleIncrease() {
    ExponentialBackOff backOff = new ExponentialBackOff(100L, 2.0);
    BackOffExecution execution = backOff.start();
    assertEquals(100l, execution.nextBackOff());
    assertEquals(200l, execution.nextBackOff());
    assertEquals(400l, execution.nextBackOff());
    assertEquals(800l, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(800l, execution.nextBackOff());
  }

  @Test
  public void fixedIncrease() {
    ExponentialBackOff backOff = new ExponentialBackOff(100L, 1.0);
    backOff.setMaxElapsedTime(300l);

    BackOffExecution execution = backOff.start();
    assertEquals(100l, execution.nextBackOff());
    assertEquals(100l, execution.nextBackOff());
    assertEquals(100l, execution.nextBackOff());
    assertEquals(BackOffExecution.STOP, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(BackOffExecution.STOP, execution.nextBackOff());
  }

  @Test
  public void maxIntervalReached() {
    ExponentialBackOff backOff = new ExponentialBackOff(2000L, 2.0);
    backOff.setMaxInterval(4000L);

    BackOffExecution execution = backOff.start();
    assertEquals(2000l, execution.nextBackOff());
    assertEquals(4000l, execution.nextBackOff());
    assertEquals(4000l, execution.nextBackOff()); // max reached
    assertEquals(4000l, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(4000l, execution.nextBackOff());
  }

  @Test
  public void maxAttemptsReached() {
    ExponentialBackOff backOff = new ExponentialBackOff(2000L, 2.0);
    backOff.setMaxElapsedTime(4000L);

    BackOffExecution execution = backOff.start();
    assertEquals(2000l, execution.nextBackOff());
    assertEquals(4000l, execution.nextBackOff());
    assertEquals(BackOffExecution.STOP, execution.nextBackOff()); // > 4 sec wait in total
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(BackOffExecution.STOP, execution.nextBackOff()); // > 4 sec wait in total
  }

  @Test
  public void startReturnDifferentInstances() {
    ExponentialBackOff backOff = new ExponentialBackOff();
    backOff.setInitialInterval(2000L);
    backOff.setMultiplier(2.0);
    backOff.setMaxElapsedTime(4000L);

    BackOffExecution execution = backOff.start();
    BackOffExecution execution2 = backOff.start();

    assertEquals(2000l, execution.nextBackOff());
    assertEquals(2000l, execution2.nextBackOff());
    assertEquals(4000l, execution.nextBackOff());
    assertEquals(4000l, execution2.nextBackOff());
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    assertEquals(BackOffExecution.STOP, execution2.nextBackOff());
  }

  @Test
  public void invalidInterval() {
    ExponentialBackOff backOff = new ExponentialBackOff();

    thrown.expect(IllegalArgumentException.class);
    backOff.setMultiplier(0.9);
  }
View Full Code Here

Examples of org.springframework.util.backoff.ExponentialBackOff

    backOff.setMultiplier(0.9);
  }

  @Test
  public void maxIntervalReachedImmediately() {
    ExponentialBackOff backOff = new ExponentialBackOff(1000L, 2.0);
    backOff.setMaxInterval(50L);

    BackOffExecution execution = backOff.start();
    assertEquals(50L, execution.nextBackOff());
    assertEquals(50L, execution.nextBackOff());
  }
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.