Skip to content

Commit 89dac79

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** # Conflicts: # spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/BlockingQueueConsumer.java
1 parent d04a20a commit 89dac79

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
@@ -81,6 +81,7 @@
8181
* @author Artem Bilan
8282
* @author Alex Panchenko
8383
* @author Johno Crawford
84+
* @author Ian Roberts
8485
*/
8586
public class BlockingQueueConsumer {
8687

@@ -593,15 +594,15 @@ public void start() throws AmqpException {
593594
if (passiveDeclareRetries > 0 && this.channel.isOpen()) {
594595
if (logger.isWarnEnabled()) {
595596
logger.warn("Queue declaration failed; retries left=" + (passiveDeclareRetries), e);
596-
try {
597-
Thread.sleep(this.failedDeclarationRetryInterval);
598-
}
599-
catch (InterruptedException e1) {
600-
this.declaring = false;
601-
Thread.currentThread().interrupt();
602-
this.activeObjectCounter.release(this);
603-
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
604-
}
597+
}
598+
try {
599+
Thread.sleep(this.failedDeclarationRetryInterval);
600+
}
601+
catch (InterruptedException e1) {
602+
this.declaring = false;
603+
Thread.currentThread().interrupt();
604+
this.activeObjectCounter.release(this);
605+
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
605606
}
606607
}
607608
else if (e.getFailedQueues().size() < this.queues.length) {

0 commit comments

Comments
 (0)