activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r1423481 - in /activemq/trunk/activemq-client/src/main/java/org/apache/activemq: ActiveMQMessageAudit.java ActiveMQMessageAuditNoSync.java
Date Tue, 18 Dec 2012 15:45:56 GMT
Author: rajdavies
Date: Tue Dec 18 15:45:55 2012
New Revision: 1423481

URL: http://svn.apache.org/viewvc?rev=1423481&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/AMQ-4233

Modified:
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAuditNoSync.java

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java?rev=1423481&r1=1423480&r2=1423481&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAudit.java
Tue Dec 18 15:45:55 2012
@@ -80,4 +80,10 @@ public class ActiveMQMessageAudit extend
             return super.isInOrder(id);
         }
     }
+
+    public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack) {
+        synchronized (this) {
+            super.setMaximumNumberOfProducersToTrack(maximumNumberOfProducersToTrack);
+        }
+    }
 }

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAuditNoSync.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAuditNoSync.java?rev=1423481&r1=1423480&r2=1423481&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAuditNoSync.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageAuditNoSync.java
Tue Dec 18 15:45:55 2012
@@ -89,8 +89,19 @@ public class ActiveMQMessageAuditNoSync 
      * @param maximumNumberOfProducersToTrack the maximumNumberOfProducersToTrack to set
      */
     public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack) {
-        this.maximumNumberOfProducersToTrack = maximumNumberOfProducersToTrack;
+
+        if (maximumNumberOfProducersToTrack < this.maximumNumberOfProducersToTrack){
+            LRUCache<Object, BitArrayBin> newMap = new LRUCache<Object, BitArrayBin>(0,maximumNumberOfProducersToTrack,0.75f,true);
+            /**
+             * As putAll will access the entries in the right order,
+             * this shouldn't result in wrong cache entries being removed
+             */
+            newMap.putAll(this.map);
+            this.map.clear();
+            this.map.putAll(newMap);
+        }
         this.map.setMaxCacheSize(maximumNumberOfProducersToTrack);
+        this.maximumNumberOfProducersToTrack = maximumNumberOfProducersToTrack;
         this.modified = true;
     }
 



Mime
View raw message