mirror of https://github.com/apache/activemq.git
some unnecessary memory allocations removed
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@581167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
53c4e125f6
commit
6aa4bcad5b
|
@ -27,7 +27,7 @@ import org.apache.activemq.util.LRUCache;
|
|||
class ConnectionAudit {
|
||||
|
||||
private boolean checkForDuplicates;
|
||||
private LinkedHashMap<ActiveMQDestination, ActiveMQMessageAudit> queues = new LRUCache<ActiveMQDestination, ActiveMQMessageAudit>(1000);
|
||||
private LinkedHashMap<ActiveMQDestination, ActiveMQMessageAudit> destinations = new LRUCache<ActiveMQDestination, ActiveMQMessageAudit>(1000);
|
||||
private LinkedHashMap<ActiveMQDispatcher, ActiveMQMessageAudit> dispatchers = new LRUCache<ActiveMQDispatcher, ActiveMQMessageAudit>(1000);
|
||||
|
||||
synchronized void removeDispatcher(ActiveMQDispatcher dispatcher) {
|
||||
|
@ -39,10 +39,10 @@ class ConnectionAudit {
|
|||
ActiveMQDestination destination = message.getDestination();
|
||||
if (destination != null) {
|
||||
if (destination.isQueue()) {
|
||||
ActiveMQMessageAudit audit = queues.get(destination);
|
||||
ActiveMQMessageAudit audit = destinations.get(destination);
|
||||
if (audit == null) {
|
||||
audit = new ActiveMQMessageAudit();
|
||||
queues.put(destination, audit);
|
||||
destinations.put(destination, audit);
|
||||
}
|
||||
boolean result = audit.isDuplicateMessageReference(message);
|
||||
return result;
|
||||
|
@ -64,7 +64,7 @@ class ConnectionAudit {
|
|||
ActiveMQDestination destination = message.getDestination();
|
||||
if (destination != null) {
|
||||
if (destination.isQueue()) {
|
||||
ActiveMQMessageAudit audit = queues.get(destination);
|
||||
ActiveMQMessageAudit audit = destinations.get(destination);
|
||||
if (audit != null) {
|
||||
audit.rollbackMessageReference(message);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
|||
*
|
||||
* @version $Revision:$
|
||||
*/
|
||||
public class LRUMap extends LinkedHashMap {
|
||||
public class LRUMap<K,V> extends LinkedHashMap<K,V>{
|
||||
|
||||
protected static final float DEFAULT_LOAD_FACTOR = (float) 0.75;
|
||||
protected static final int DEFAULT_INITIAL_CAPACITY = 5000;
|
||||
|
@ -45,7 +45,7 @@ public class LRUMap extends LinkedHashMap {
|
|||
this.maximumSize = maximumSize;
|
||||
}
|
||||
|
||||
protected boolean removeEldestEntry(Map.Entry eldest) {
|
||||
protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
|
||||
return size() > maximumSize;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue