use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method maxAttemptsReached.
@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());
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method liveUpdate.
@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());
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method defaultInstance.
@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());
}
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method startReturnDifferentInstances.
@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());
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class JmsNamespaceHandlerTests method getRecoveryInterval.
private long getRecoveryInterval(String containerBeanName) {
BackOff backOff = getBackOff(containerBeanName);
assertEquals(FixedBackOff.class, backOff.getClass());
return ((FixedBackOff) backOff).getInterval();
}
Aggregations