Skip to content

Commit c5c6ca3

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 514fa92 commit c5c6ca3

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
@@ -85,6 +85,7 @@
8585
* @author Artem Bilan
8686
* @author Alex Panchenko
8787
* @author Johno Crawford
88+
* @author Ian Roberts
8889
*/
8990
public class BlockingQueueConsumer {
9091

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

0 commit comments

Comments
 (0)