git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1423481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2012-12-18 15:45:55 +00:00
parent 22bc55b948
commit 14e76891e2
2 changed files with 18 additions and 1 deletions

View File

@ -80,4 +80,10 @@ public class ActiveMQMessageAudit extends ActiveMQMessageAuditNoSync {
return super.isInOrder(id); return super.isInOrder(id);
} }
} }
public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack) {
synchronized (this) {
super.setMaximumNumberOfProducersToTrack(maximumNumberOfProducersToTrack);
}
}
} }

View File

@ -89,8 +89,19 @@ public class ActiveMQMessageAuditNoSync implements Serializable {
* @param maximumNumberOfProducersToTrack the maximumNumberOfProducersToTrack to set * @param maximumNumberOfProducersToTrack the maximumNumberOfProducersToTrack to set
*/ */
public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack) { 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.map.setMaxCacheSize(maximumNumberOfProducersToTrack);
this.maximumNumberOfProducersToTrack = maximumNumberOfProducersToTrack;
this.modified = true; this.modified = true;
} }