Skip to content

Commit e98e8c5

Browse files
ianrobertsartembilan
authored andcommitted
Sleep for failed declaration out of warn block
* Respect `failedDeclarationRetryInterval` even when logging is not enabled. **Cherry-pick to 2.1.x, 2.0.x & 1.7.x**
1 parent c1defb5 commit e98e8c5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/BlockingQueueConsumer.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
* @author Artem Bilan
8787
* @author Alex Panchenko
8888
* @author Johno Crawford
89+
* @author Ian Roberts
8990
*/
9091
public class BlockingQueueConsumer {
9192

@@ -637,15 +638,15 @@ private void handleDeclarationException(int passiveDeclareRetries, DeclarationEx
637638
if (passiveDeclareRetries > 0 && this.channel.isOpen()) {
638639
if (logger.isWarnEnabled()) {
639640
logger.warn("Queue declaration failed; retries left=" + (passiveDeclareRetries), e);
640-
try {
641-
Thread.sleep(this.failedDeclarationRetryInterval);
642-
}
643-
catch (InterruptedException e1) {
644-
this.declaring = false;
645-
Thread.currentThread().interrupt();
646-
this.activeObjectCounter.release(this);
647-
throw RabbitExceptionTranslator.convertRabbitAccessException(e1); // NOSONAR stack trace loss
648-
}
641+
}
642+
try {
643+
Thread.sleep(this.failedDeclarationRetryInterval);
644+
}
645+
catch (InterruptedException e1) {
646+
this.declaring = false;
647+
Thread.currentThread().interrupt();
648+
this.activeObjectCounter.release(this);
649+
throw RabbitExceptionTranslator.convertRabbitAccessException(e1); // NOSONAR stack trace loss
649650
}
650651
}
651652
else if (e.getFailedQueues().size() < this.queues.length) {

0 commit comments

Comments
 (0)