git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1215433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2011-12-17 07:05:46 +00:00
parent aa3ab12234
commit 7da61d992f
2 changed files with 56 additions and 14 deletions

View File

@ -16,11 +16,21 @@
*/
package org.apache.activemq.store.kahadb;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import org.apache.activeio.journal.Journal;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.BrokerServiceAware;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.command.*;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.command.LocalTransactionId;
import org.apache.activemq.command.ProducerId;
import org.apache.activemq.command.TransactionId;
import org.apache.activemq.command.XATransactionId;
import org.apache.activemq.protobuf.Buffer;
import org.apache.activemq.store.MessageStore;
import org.apache.activemq.store.PersistenceAdapter;
@ -31,10 +41,6 @@ import org.apache.activemq.store.kahadb.data.KahaTransactionInfo;
import org.apache.activemq.store.kahadb.data.KahaXATransactionId;
import org.apache.activemq.usage.SystemUsage;
import java.io.File;
import java.io.IOException;
import java.util.Set;
/**
* An implementation of {@link PersistenceAdapter} designed for use with a
* {@link Journal} and then check pointing asynchronously on a timeout with some
@ -515,6 +521,22 @@ public class KahaDBPersistenceAdapter implements PersistenceAdapter, BrokerServi
return letter.isRewriteOnRedelivery();
}
public float getIndexLFUEvictionFactor() {
return letter.getIndexLFUEvictionFactor();
}
public void setIndexLFUEvictionFactor(float indexLFUEvictionFactor) {
letter.setIndexLFUEvictionFactor(indexLFUEvictionFactor);
}
public boolean isUseIndexLFRUEviction() {
return letter.isUseIndexLFRUEviction();
}
public void setUseIndexLFRUEviction(boolean useIndexLFRUEviction) {
letter.setUseIndexLFRUEviction(useIndexLFRUEviction);
}
public KahaDBStore getStore() {
return letter;
}

View File

@ -16,6 +16,15 @@
*/
package org.apache.activemq.store.kahadb;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.activemq.ActiveMQMessageAuditNoSync;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.BrokerServiceAware;
@ -41,15 +50,6 @@ import org.apache.kahadb.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public abstract class MessageDatabase extends ServiceSupport implements BrokerServiceAware {
protected BrokerService brokerService;
@ -182,6 +182,8 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
private final Object checkpointThreadLock = new Object();
private boolean rewriteOnRedelivery = false;
private boolean archiveCorruptedIndex = false;
private boolean useIndexLFRUEviction = false;
private float indexLFUEvictionFactor = 0.2f;
public MessageDatabase() {
}
@ -2054,6 +2056,8 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
index.setEnableWriteThread(isEnableIndexWriteAsync());
index.setWriteBatchSize(getIndexWriteBatchSize());
index.setPageCacheSize(indexCacheSize);
index.setUseLFRUEviction(isUseIndexLFRUEviction());
index.setLFUEvictionFactor(getIndexLFUEvictionFactor());
return index;
}
@ -2277,6 +2281,22 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
this.archiveCorruptedIndex = archiveCorruptedIndex;
}
public float getIndexLFUEvictionFactor() {
return indexLFUEvictionFactor;
}
public void setIndexLFUEvictionFactor(float indexLFUEvictionFactor) {
this.indexLFUEvictionFactor = indexLFUEvictionFactor;
}
public boolean isUseIndexLFRUEviction() {
return useIndexLFRUEviction;
}
public void setUseIndexLFRUEviction(boolean useIndexLFRUEviction) {
this.useIndexLFRUEviction = useIndexLFRUEviction;
}
// /////////////////////////////////////////////////////////////////
// Internal conversion methods.
// /////////////////////////////////////////////////////////////////