activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r817842 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region: BaseDestination.java Queue.java Topic.java
Date Tue, 22 Sep 2009 21:12:52 GMT
Author: cmacnaug
Date: Tue Sep 22 21:12:49 2009
New Revision: 817842

URL: http://svn.apache.org/viewvc?rev=817842&view=rev
Log:
Changing memory limit flow control warning messages to be one time messages [http://issues.apache.org/activemq/browse/AMQ-2401]

This avoids performance penalty of constant logging since under normal circumstance producers
will be going in and out of flow control frequently. 

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java?rev=817842&r1=817841&r2=817842&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/BaseDestination.java
Tue Sep 22 21:12:49 2009
@@ -51,6 +51,7 @@
     protected SystemUsage systemUsage;
     protected MemoryUsage memoryUsage;
     private boolean producerFlowControl = false;
+    protected boolean warnOnProducerFlowControl = true; 
     private int maxProducersToAudit = 1024;
     private int maxAuditDepth = 2048;
     private boolean enableAudit = true;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=817842&r1=817841&r2=817842&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Tue Sep 22 21:12:49 2009
@@ -412,11 +412,15 @@
             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(warnOnProducerFlowControl) {
+                    warnOnProducerFlowControl = false;
+                    LOG.info("Usage Manager memory limit reached on " +getActiveMQDestination().getQualifiedName()
+ ". Producers will be throttled to the rate at which messages are removed from this destination
to prevent flooding it." +
+                            " See http://activemq.apache.org/producer-flow-control.html for
more info");
+                }
+                
                 if (systemUsage.isSendFailIfNoSpace()) {
-                    throw new javax.jms.ResourceAllocationException("SystemUsage memory limit
reached");
+                    throw new javax.jms.ResourceAllocationException("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");
                 }
     
                 // We can avoid blocking due to low usage if the producer is sending

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java?rev=817842&r1=817841&r2=817842&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
Tue Sep 22 21:12:49 2009
@@ -280,14 +280,20 @@
         if(memoryUsage.isFull()) {
             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(warnOnProducerFlowControl) {
+                    warnOnProducerFlowControl = false;
+                    LOG.info("Usage Manager memory limit reached for " +getActiveMQDestination().getQualifiedName()
+ ". Producers will be throttled to the rate at which messages are removed from this destination
to prevent flooding it." +
+                            " See http://activemq.apache.org/producer-flow-control.html for
more info");
+                }
+                
                 if (systemUsage.isSendFailIfNoSpace()) {
-                    throw new javax.jms.ResourceAllocationException(logMessage);
+                    throw new javax.jms.ResourceAllocationException("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");
                 }
-    
+   
                 // We can avoid blocking due to low usage if the producer is sending
                 // a sync message or
                 // if it is using a producer window



Mime
View raw message