use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method noAttemptAtAll.
@Test
public void noAttemptAtAll() {
FixedBackOff backOff = new FixedBackOff(100L, 0L);
BackOffExecution execution = backOff.start();
assertEquals(BackOffExecution.STOP, execution.nextBackOff());
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class FixedBackOffTests method toStringContent.
@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());
}
use of org.springframework.util.backoff.FixedBackOff in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method backOffOverridesRecoveryInterval.
@Test
public void backOffOverridesRecoveryInterval() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
BackOff backOff = new FixedBackOff();
factory.setBackOff(backOff);
factory.setRecoveryInterval(2000L);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertSame(backOff, new DirectFieldAccessor(container).getPropertyValue("backOff"));
}
Aggregations