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
This commit is contained in:
Ian Roberts
2019-07-17 20:45:26 +01:00
committed by Artem Bilan
parent beb208c50d
commit d9686822dc

View File

@@ -80,6 +80,7 @@ import com.rabbitmq.utility.Utility;
* @author Artem Bilan
* @author Alex Panchenko
* @author Johno Crawford
* @author Ian Roberts
*/
public class BlockingQueueConsumer {
@@ -603,15 +604,15 @@ public class BlockingQueueConsumer {
if (passiveDeclareRetries > 0 && this.channel.isOpen()) {
if (logger.isWarnEnabled()) {
logger.warn("Queue declaration failed; retries left=" + (passiveDeclareRetries), e);
try {
Thread.sleep(this.failedDeclarationRetryInterval);
}
catch (InterruptedException e1) {
this.declaring = false;
Thread.currentThread().interrupt();
this.activeObjectCounter.release(this);
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
}
}
try {
Thread.sleep(this.failedDeclarationRetryInterval);
}
catch (InterruptedException e1) {
this.declaring = false;
Thread.currentThread().interrupt();
this.activeObjectCounter.release(this);
throw RabbitExceptionTranslator.convertRabbitAccessException(e1);
}
}
else if (e.getFailedQueues().size() < this.queues.length) {