Examples of BackOffExecution


Examples of org.springframework.util.backoff.BackOffExecution

   * @see #setRecoveryInterval
   * @see #start()
   * @see #stop()
   */
  protected void refreshConnectionUntilSuccessful() {
    BackOffExecution execution = this.backOff.start();
    while (isRunning()) {
      try {
        if (sharedConnectionEnabled()) {
          refreshSharedConnection();
        }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

     * failed to recover with the broker. This additional sleep period avoids a burst retry
     * scenario when the broker is actually up but something else if failing (i.e. listener
     * specific).
     */
    private void sleepBeforeRecoveryAttempt() {
      BackOffExecution execution = DefaultMessageListenerContainer.this.backOff.start();
      applyBackOffTime(execution);
    }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  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.BackOffExecution

public class FixedBackOffTests {

  @Test
  public void defaultInstance() {
    FixedBackOff backOff = new FixedBackOff();
    BackOffExecution execution = backOff.start();
    for (int i = 0; i < 100; i++) {
      assertEquals(FixedBackOff.DEFAULT_INTERVAL, execution.nextBackOff());
    }
  }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @Test
  public void noAttemptAtAll() {
    FixedBackOff backOff = new FixedBackOff(100L, 0L);
    BackOffExecution execution = backOff.start();
    assertEquals(BackOffExecution.STOP, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @Test
  public void maxAttemptsReached() {
    FixedBackOff backOff = new FixedBackOff(200L, 2);
    BackOffExecution execution = backOff.start();
    assertEquals(200l, execution.nextBackOff());
    assertEquals(200l, execution.nextBackOff());
    assertEquals(BackOffExecution.STOP, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @Test
  public void startReturnDifferentInstances() {
    FixedBackOff backOff = new FixedBackOff(100L, 1);
    BackOffExecution execution = backOff.start();
    BackOffExecution execution2 = backOff.start();

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

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @Test
  public void liveUpdate() {
    FixedBackOff backOff = new FixedBackOff(100L, 1);
    BackOffExecution execution = backOff.start();
    assertEquals(100l, execution.nextBackOff());

    backOff.setInterval(200l);
    backOff.setMaxAttempts(2);

    assertEquals(200l, execution.nextBackOff());
    assertEquals(BackOffExecution.STOP, execution.nextBackOff());
  }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @Test
  public void toStringContent() {
    FixedBackOff backOff = new FixedBackOff(200L, 10);
    BackOffExecution execution = backOff.start();
    assertEquals("FixedBackOff{interval=200, currentAttempts=0, maxAttempts=10}", execution.toString());
    execution.nextBackOff();
    assertEquals("FixedBackOff{interval=200, currentAttempts=1, maxAttempts=10}", execution.toString());
    execution.nextBackOff();
    assertEquals("FixedBackOff{interval=200, currentAttempts=2, maxAttempts=10}", execution.toString());
  }
View Full Code Here

Examples of org.springframework.util.backoff.BackOffExecution

  }

  @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
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.