mirror of https://github.com/apache/activemq.git
add configuration of cache size
This commit is contained in:
parent
7f17f49d73
commit
db2121bfce
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue