Package org.apache.activemq.store.kahadb
Class MultiKahaDBPersistenceAdapter
- java.lang.Object
- 
- org.apache.activemq.util.ServiceSupport
- 
- org.apache.activemq.broker.LockableServiceSupport
- 
- org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter
 
 
 
- 
- All Implemented Interfaces:
- BrokerServiceAware,- Lockable,- Service,- NoLocalSubscriptionAware,- PersistenceAdapter
 
 public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implements PersistenceAdapter, BrokerServiceAware, NoLocalSubscriptionAware An implementation ofPersistenceAdapterthat supports distribution of destinations across multiple kahaDB persistence adapters
- 
- 
Field Summary- 
Fields inherited from class org.apache.activemq.broker.LockableServiceSupportbrokerService, clockDaemon
 
- 
 - 
Constructor SummaryConstructors Constructor Description MultiKahaDBPersistenceAdapter()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallowIOResumption()voidbeginTransaction(ConnectionContext context)This method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimization.voidcheckpoint(boolean cleanup)checkpoint anyvoidcommitTransaction(ConnectionContext context)Commit a persistence transactionLockercreateDefaultLocker()Create a default lockerJobSchedulerStorecreateJobSchedulerStore()Creates and returns a new Job Scheduler store instance.MessageStorecreateQueueMessageStore(ActiveMQQueue destination)Factory method to create a new queue message store with the given destination nameTopicMessageStorecreateTopicMessageStore(ActiveMQTopic destination)Factory method to create a new topic message store with the given destination nameTransactionStorecreateTransactionStore()Factory method to create a new persistent prepared transaction store for XA recoveryvoiddeleteAllMessages()Delete's all the messages in the persistent store.voiddoStart()protected voiddoStop(ServiceStopper stopper)List<PersistenceAdapter>getAdapters()Set<ActiveMQDestination>getDestinations()Returns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.FilegetDirectory()longgetJournalCleanupInterval()intgetJournalMaxFileLength()intgetJournalWriteBatchSize()longgetLastMessageBrokerSequenceId()longgetLastProducerSequenceId(ProducerId id)return the last stored producer sequenceId for this producer Id used to suppress duplicate sends on failover reconnect at the transport when a reconnect occursvoidinit()Initialize resources before lockingbooleanisCheckForCorruption()booleanisLocalXid(TransactionId xid)booleanisPersistNoLocal()static StringnameFromDestinationFilter(ActiveMQDestination destination)voidremoveQueueMessageStore(ActiveMQQueue destination)Cleanup method to remove any state associated with the given destination.voidremoveTopicMessageStore(ActiveMQTopic destination)Cleanup method to remove any state associated with the given destination This method does not stop the message store (it might not be cached).voidrollbackTransaction(ConnectionContext context)Rollback a persistence transactionvoidsetBrokerName(String brokerName)Set the name of the broker using the adaptervoidsetBrokerService(BrokerService brokerService)voidsetCheckForCorruption(boolean checkForCorruption)voidsetDirectory(File directory)Set the directory where any data files should be createdvoidsetFilteredPersistenceAdapters(List entries)Sets the FilteredKahaDBPersistenceAdapter entriesvoidsetJournalCleanupInterval(long journalCleanupInterval)voidsetJournalMaxFileLength(int maxFileLength)Set the max file length of the transaction journal When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be usedvoidsetJournalWriteBatchSize(int journalWriteBatchSize)Set the max write batch size of the transaction journal When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be usedvoidsetTransactionStore(MultiKahaDBTransactionStore transactionStore)voidsetUsageManager(SystemUsage usageManager)longsize()A hint to return the size of the store on diskStringtoString()- 
Methods inherited from class org.apache.activemq.broker.LockableServiceSupportgetBrokerService, getLocker, getLockKeepAlivePeriod, getScheduledThreadPoolExecutor, isStopOnError, isUseLock, keepLockAlive, postStop, preStart, setLocker, setLockKeepAlivePeriod, setScheduledThreadPoolExecutor, setStopOnError, setUseLock, stopBroker
 - 
Methods inherited from class org.apache.activemq.util.ServiceSupportaddServiceListener, dispose, isStarted, isStopped, isStopping, removeServiceListener, start, stop
 
- 
 
- 
- 
- 
Method Detail- 
setFilteredPersistenceAdapterspublic void setFilteredPersistenceAdapters(List entries) Sets the FilteredKahaDBPersistenceAdapter entries
 - 
nameFromDestinationFilterpublic static String nameFromDestinationFilter(ActiveMQDestination destination) 
 - 
isLocalXidpublic boolean isLocalXid(TransactionId xid) 
 - 
beginTransactionpublic void beginTransaction(ConnectionContext context) throws IOException Description copied from interface:PersistenceAdapterThis method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimization. Typically one transaction will require one disk synchronization point and so for real high performance its usually faster to perform many writes within the same transaction to minimize latency caused by disk synchronization. This is especially true when using tools like Berkeley Db or embedded JDBC servers.- Specified by:
- beginTransactionin interface- PersistenceAdapter
- Throws:
- IOException
 
 - 
checkpointpublic void checkpoint(boolean cleanup) throws IOExceptionDescription copied from interface:PersistenceAdaptercheckpoint any- Specified by:
- checkpointin interface- PersistenceAdapter
- Throws:
- IOException
 
 - 
commitTransactionpublic void commitTransaction(ConnectionContext context) throws IOException Description copied from interface:PersistenceAdapterCommit a persistence transaction- Specified by:
- commitTransactionin interface- PersistenceAdapter
- Throws:
- IOException
- See Also:
- PersistenceAdapter.beginTransaction(ConnectionContext context)
 
 - 
createQueueMessageStorepublic MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException Description copied from interface:PersistenceAdapterFactory method to create a new queue message store with the given destination name- Specified by:
- createQueueMessageStorein interface- PersistenceAdapter
- Returns:
- the message store
- Throws:
- IOException
 
 - 
createTopicMessageStorepublic TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException Description copied from interface:PersistenceAdapterFactory method to create a new topic message store with the given destination name- Specified by:
- createTopicMessageStorein interface- PersistenceAdapter
- Returns:
- the topic message store
- Throws:
- IOException
 
 - 
createTransactionStorepublic TransactionStore createTransactionStore() throws IOException Description copied from interface:PersistenceAdapterFactory method to create a new persistent prepared transaction store for XA recovery- Specified by:
- createTransactionStorein interface- PersistenceAdapter
- Returns:
- transaction store
- Throws:
- IOException
 
 - 
deleteAllMessagespublic void deleteAllMessages() throws IOExceptionDescription copied from interface:PersistenceAdapterDelete's all the messages in the persistent store.- Specified by:
- deleteAllMessagesin interface- PersistenceAdapter
- Throws:
- IOException
 
 - 
getDestinationspublic Set<ActiveMQDestination> getDestinations() Description copied from interface:PersistenceAdapterReturns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.- Specified by:
- getDestinationsin interface- PersistenceAdapter
- Returns:
- active destinations
 
 - 
getLastMessageBrokerSequenceIdpublic long getLastMessageBrokerSequenceId() throws IOException- Specified by:
- getLastMessageBrokerSequenceIdin interface- PersistenceAdapter
- Returns:
- last broker sequence
- Throws:
- IOException
 
 - 
getLastProducerSequenceIdpublic long getLastProducerSequenceId(ProducerId id) throws IOException Description copied from interface:PersistenceAdapterreturn the last stored producer sequenceId for this producer Id used to suppress duplicate sends on failover reconnect at the transport when a reconnect occurs- Specified by:
- getLastProducerSequenceIdin interface- PersistenceAdapter
- Parameters:
- id- the producerId to find a sequenceId for
- Returns:
- the last stored sequence id or -1 if no suppression needed
- Throws:
- IOException
 
 - 
allowIOResumptionpublic void allowIOResumption() - Specified by:
- allowIOResumptionin interface- PersistenceAdapter
 
 - 
removeQueueMessageStorepublic void removeQueueMessageStore(ActiveMQQueue destination) Description copied from interface:PersistenceAdapterCleanup method to remove any state associated with the given destination. This method does not stop the message store (it might not be cached).- Specified by:
- removeQueueMessageStorein interface- PersistenceAdapter
- Parameters:
- destination- Destination to forget
 
 - 
removeTopicMessageStorepublic void removeTopicMessageStore(ActiveMQTopic destination) Description copied from interface:PersistenceAdapterCleanup method to remove any state associated with the given destination This method does not stop the message store (it might not be cached).- Specified by:
- removeTopicMessageStorein interface- PersistenceAdapter
- Parameters:
- destination- Destination to forget
 
 - 
rollbackTransactionpublic void rollbackTransaction(ConnectionContext context) throws IOException Description copied from interface:PersistenceAdapterRollback a persistence transaction- Specified by:
- rollbackTransactionin interface- PersistenceAdapter
- Throws:
- IOException
- See Also:
- PersistenceAdapter.beginTransaction(ConnectionContext context)
 
 - 
setBrokerNamepublic void setBrokerName(String brokerName) Description copied from interface:PersistenceAdapterSet the name of the broker using the adapter- Specified by:
- setBrokerNamein interface- PersistenceAdapter
 
 - 
setUsageManagerpublic void setUsageManager(SystemUsage usageManager) - Specified by:
- setUsageManagerin interface- PersistenceAdapter
- Parameters:
- usageManager- The UsageManager that is controlling the broker's memory usage.
 
 - 
sizepublic long size() Description copied from interface:PersistenceAdapterA hint to return the size of the store on disk- Specified by:
- sizein interface- PersistenceAdapter
- Returns:
- disk space used in bytes of 0 if not implemented
 
 - 
doStartpublic void doStart() throws Exception- Specified by:
- doStartin class- ServiceSupport
- Throws:
- Exception
 
 - 
doStopprotected void doStop(ServiceStopper stopper) throws Exception - Specified by:
- doStopin class- ServiceSupport
- Throws:
- Exception
 
 - 
getDirectorypublic File getDirectory() - Specified by:
- getDirectoryin interface- PersistenceAdapter
- Returns:
- the directory used by the persistence adaptor
 
 - 
setDirectorypublic void setDirectory(File directory) Description copied from interface:PersistenceAdapterSet the directory where any data files should be created- Specified by:
- setDirectoryin interface- PersistenceAdapter
 
 - 
initpublic void init() throws ExceptionDescription copied from class:LockableServiceSupportInitialize resources before locking- Specified by:
- initin class- LockableServiceSupport
- Throws:
- Exception
 
 - 
setBrokerServicepublic void setBrokerService(BrokerService brokerService) - Specified by:
- setBrokerServicein interface- BrokerServiceAware
- Overrides:
- setBrokerServicein class- LockableServiceSupport
 
 - 
setTransactionStorepublic void setTransactionStore(MultiKahaDBTransactionStore transactionStore) 
 - 
setJournalMaxFileLengthpublic void setJournalMaxFileLength(int maxFileLength) Set the max file length of the transaction journal When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used
 - 
getJournalMaxFileLengthpublic int getJournalMaxFileLength() 
 - 
setJournalWriteBatchSizepublic void setJournalWriteBatchSize(int journalWriteBatchSize) Set the max write batch size of the transaction journal When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used
 - 
getJournalWriteBatchSizepublic int getJournalWriteBatchSize() 
 - 
setJournalCleanupIntervalpublic void setJournalCleanupInterval(long journalCleanupInterval) 
 - 
getJournalCleanupIntervalpublic long getJournalCleanupInterval() 
 - 
setCheckForCorruptionpublic void setCheckForCorruption(boolean checkForCorruption) 
 - 
isCheckForCorruptionpublic boolean isCheckForCorruption() 
 - 
getAdapterspublic List<PersistenceAdapter> getAdapters() 
 - 
createDefaultLockerpublic Locker createDefaultLocker() throws IOException Description copied from interface:LockableCreate a default locker- Specified by:
- createDefaultLockerin interface- Lockable
- Returns:
- default locker
- Throws:
- IOException
 
 - 
createJobSchedulerStorepublic JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException Description copied from interface:PersistenceAdapterCreates and returns a new Job Scheduler store instance.- Specified by:
- createJobSchedulerStorein interface- PersistenceAdapter
- Returns:
- a new JobSchedulerStore instance if this Persistence adapter provides its own.
- Throws:
- IOException- If an error occurs while creating the new JobSchedulerStore.
- UnsupportedOperationException- If this adapter does not provide its own scheduler store implementation.
 
 - 
isPersistNoLocalpublic boolean isPersistNoLocal() - Specified by:
- isPersistNoLocalin interface- NoLocalSubscriptionAware
 
 
- 
 
-