activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r635565 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
Date Mon, 10 Mar 2008 14:16:51 GMT
Author: rajdavies
Date: Mon Mar 10 07:16:49 2008
New Revision: 635565

URL: http://svn.apache.org/viewvc?rev=635565&view=rev
Log:
Fix problem in message state tracker that will result on OME

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java?rev=635565&r1=635564&r2=635565&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
Mon Mar 10 07:16:49 2008
@@ -63,7 +63,9 @@
     private Map<MessageId,Message> messageCache = new LinkedHashMap<MessageId,Message>(){
         protected boolean removeEldestEntry(Map.Entry<MessageId,Message> eldest) {
             boolean result = currentCacheSize > maxCacheSize;
-            currentCacheSize -= eldest.getValue().getSize();
+            if (result) {
+                currentCacheSize -= eldest.getValue().getSize();
+            }
             return result;
         }
     };
@@ -104,7 +106,7 @@
         if (trackMessages && command != null && command.isMessage()) {
             Message message = (Message) command;
             if (message.getTransactionId()==null) {
-                currentCacheSize+=message.getSize();
+                currentCacheSize = currentCacheSize +  message.getSize();
             }
         }
     }



Mime
View raw message