activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lurga <...@netease.com>
Subject Re: memoryUsage configuration
Date Tue, 11 Nov 2008 09:02:32 GMT

Queue invokes memoryUsage.isFull() method to decide when to block producer
sending message, and FilePendingCursor invokes hasSpace() method (uses
systemUsage of the Queue) to decide when to flush messages to disk. I made a
patch to avoid diverse results from these two different ways of judgement.
Now it seems to work correct. 
 
Index:
activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
===================================================================
--- activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(revision 712969)
+++ activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(working copy)
@@ -141,6 +141,12 @@
             memoryUsage.setParent(systemUsage.getMemoryUsage());
         }
         
+        long memoryUsageHighWaterMark = 
+            Math.min(memoryUsage.getLimit(),
systemUsage.getMemoryUsage().getLimit()) 
+            * messages.getMemoryUsageHighWaterMark()
+            / systemUsage.getMemoryUsage().getLimit();
+        messages.setMemoryUsageHighWaterMark((int)
memoryUsageHighWaterMark);
+        
         if (isOptimizedDispatch()) {
             this.taskRunner = taskFactory.createTaskRunner(this,
"TempQueue:  " + destination.getPhysicalName());
         }else {
-- 
View this message in context: http://www.nabble.com/memoryUsage-configuration-tp20416088p20435735.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message