Updated Branches: refs/heads/trunk 7f17f49d7 -> db2121bfc
add configuration of cache size Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/db2121bf Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/db2121bf Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/db2121bf Branch: refs/heads/trunk Commit: db2121bfce291fdccf6d04f6f2cb58eac9a2ba55 Parents: 7f17f49 Author: rajdavies <[email protected]> Authored: Fri Oct 11 11:15:35 2013 +0100 Committer: rajdavies <[email protected]> Committed: Fri Oct 11 11:15:35 2013 +0100 ---------------------------------------------------------------------- .../broker/region/group/MessageGroupHashBucket.java | 5 +++-- .../region/group/MessageGroupHashBucketFactory.java | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/db2121bf/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java index a18e4d2..652b985 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucket.java @@ -30,11 +30,12 @@ public class MessageGroupHashBucket implements MessageGroupMap { private final int bucketCount; private final ConsumerId[] consumers; - private LRUMap<String,String>cache=new LRUMap<String,String>(64); + private final LRUMap<String,String>cache; - public MessageGroupHashBucket(int bucketCount) { + public MessageGroupHashBucket(int bucketCount, int cachedSize) { this.bucketCount = bucketCount; this.consumers = new ConsumerId[bucketCount]; + this.cache=new LRUMap<String,String>(cachedSize); } public synchronized void put(String groupId, ConsumerId consumerId) { http://git-wip-us.apache.org/repos/asf/activemq/blob/db2121bf/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java index 177284b..8961c46 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/group/MessageGroupHashBucketFactory.java @@ -29,9 +29,10 @@ package org.apache.activemq.broker.region.group; public class MessageGroupHashBucketFactory implements MessageGroupMapFactory { private int bucketCount = 1024; + private int cacheSize = 64; public MessageGroupMap createMessageGroupMap() { - return new MessageGroupHashBucket(bucketCount); + return new MessageGroupHashBucket(getBucketCount(), getCacheSize()); } public int getBucketCount() { @@ -49,4 +50,12 @@ public class MessageGroupHashBucketFactory implements MessageGroupMapFactory { this.bucketCount = bucketCount; } + public int getCacheSize() { + return cacheSize; + } + + public void setCacheSize(int cacheSize) { + this.cacheSize = cacheSize; + } + }
