From d021e5b6c73160d44ba9e43ed7bf295ea6f4d76f Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Tue, 22 Sep 2009 12:39:50 +0000 Subject: [PATCH] https://issues.apache.org/activemq/browse/AMQ-2400 - producer flow control log messages for topics git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@817639 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/broker/region/Topic.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java index c1035ddcf8..4ec65e135e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java @@ -281,8 +281,11 @@ public class Topic extends BaseDestination implements Task{ isFull(context, memoryUsage); fastProducer(context, producerInfo); if (isProducerFlowControl() && context.isProducerFlowControl()) { + final String logMessage = "Usage Manager memory limit reached. Stopping producer (" + message.getProducerId() + ") to prevent flooding " +getActiveMQDestination().getQualifiedName() + "." + + " See http://activemq.apache.org/producer-flow-control.html for more info"; + LOG.info(logMessage); if (systemUsage.isSendFailIfNoSpace()) { - throw new javax.jms.ResourceAllocationException("Usage Manager memory limit reached"); + throw new javax.jms.ResourceAllocationException(logMessage); } // We can avoid blocking due to low usage if the producer is sending @@ -390,8 +393,13 @@ public class Topic extends BaseDestination implements Task{ if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) { - if (systemUsage.isSendFailIfNoSpace() && systemUsage.getStoreUsage().isFull()) { - throw new javax.jms.ResourceAllocationException("Usage Manager Store is Full"); + if (systemUsage.getStoreUsage().isFull()) { + final String logMessage = "Usage Manager Store is Full. Stopping producer (" + message.getProducerId() + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "." + + " See http://activemq.apache.org/producer-flow-control.html for more info"; + LOG.info(logMessage); + if (systemUsage.isSendFailIfNoSpace()) { + throw new javax.jms.ResourceAllocationException(logMessage); + } } while (!systemUsage.getStoreUsage().waitForSpace(1000)) { if (context.getStopping().get()) {