Skip to content

Commit d968682

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 beb208c commit d968682

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
@@ -80,6 +80,7 @@
8080
* @author Artem Bilan
8181
* @author Alex Panchenko
8282
* @author Johno Crawford
83+
* @author Ian Roberts
8384
*/
8485
public class BlockingQueueConsumer {
8586

@@ -603,15 +604,15 @@ public void start() throws AmqpException {
603604
if (passiveDeclareRetries > 0 && this.channel.isOpen()) {
604605
if (logger.isWarnEnabled()) {
605606
logger.warn("Queue declaration failed; retries left=" + (passiveDeclareRetries), e);
606-
try {
607-
Thread.sleep(this.failedDeclarationRetryInterval);
608-
}
609-
catch (InterruptedException e1) {
610-
this.declaring = false;
611-
Thread.currentThread().interrupt();
612-
this.activeObjectCounter.release(this);
613-
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
614-
}
607+
}
608+
try {
609+
Thread.sleep(this.failedDeclarationRetryInterval);
610+
}
611+
catch (InterruptedException e1) {
612+
this.declaring = false;
613+
Thread.currentThread().interrupt();
614+
this.activeObjectCounter.release(this);
615+
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
615616
}
616617
}
617618
else if (e.getFailedQueues().size() < this.queues.length) {

0 commit comments

Comments
 (0)