Package org.apache.activemq.store.memory
Class MemoryPersistenceAdapter
java.lang.Object
org.apache.activemq.store.memory.MemoryPersistenceAdapter
- All Implemented Interfaces:
BrokerServiceAware,org.apache.activemq.Service,NoLocalSubscriptionAware,PersistenceAdapter
public class MemoryPersistenceAdapter
extends Object
implements PersistenceAdapter, NoLocalSubscriptionAware, BrokerServiceAware
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected MemoryMessageStoreasMemoryMessageStore(Object value) 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 sync) checkpoint anyvoidcommitTransaction(ConnectionContext context) Commit a persistence transactionCreates and returns a new Job Scheduler store instance.createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) Factory method to create a new queue message store with the given destination namecreateTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination) Factory method to create a new topic message store with the given destination nameFactory method to create a new persistent prepared transaction store for XA recoveryvoidDelete's all the messages in the persistent store.Set<org.apache.activemq.command.ActiveMQDestination>Returns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.longlonggetLastProducerSequenceId(org.apache.activemq.command.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 occursbooleanbooleanstatic MemoryPersistenceAdapternewInstance(File file) voidremoveQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) Cleanup method to remove any state associated with the given destinationvoidremoveTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination) Cleanup method to remove any state associated with the given destinationvoidrollbackTransaction(ConnectionContext context) Rollback a persistence transactionvoidsetBrokerName(String brokerName) Set the name of the broker using the adaptervoidsetBrokerService(BrokerService brokerService) voidsetCreateTransactionStore(boolean create) voidsetDirectory(File dir) Set the directory where any data files should be createdvoidsetUsageManager(SystemUsage usageManager) voidsetUseExternalMessageReferences(boolean useExternalMessageReferences) longsize()A hint to return the size of the store on diskvoidstart()voidstop()toString()
-
Field Details
-
brokerService
-
-
Constructor Details
-
MemoryPersistenceAdapter
public MemoryPersistenceAdapter()
-
-
Method Details
-
getDestinations
Description copied from interface:PersistenceAdapterReturns a set of all theActiveMQDestinationobjects that the persistence store is aware exist.- Specified by:
getDestinationsin interfacePersistenceAdapter- Returns:
- active destinations
-
newInstance
-
createQueueMessageStore
public MessageStore createQueueMessageStore(org.apache.activemq.command.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 interfacePersistenceAdapter- Returns:
- the message store
- Throws:
IOException
-
createTopicMessageStore
public TopicMessageStore createTopicMessageStore(org.apache.activemq.command.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 interfacePersistenceAdapter- Returns:
- the topic message store
- Throws:
IOException
-
removeQueueMessageStore
public void removeQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) Cleanup method to remove any state associated with the given destination- Specified by:
removeQueueMessageStorein interfacePersistenceAdapter- Parameters:
destination- Destination to forget
-
removeTopicMessageStore
public void removeTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination) Cleanup method to remove any state associated with the given destination- Specified by:
removeTopicMessageStorein interfacePersistenceAdapter- Parameters:
destination- Destination to forget
-
createTransactionStore
Description copied from interface:PersistenceAdapterFactory method to create a new persistent prepared transaction store for XA recovery- Specified by:
createTransactionStorein interfacePersistenceAdapter- Returns:
- transaction store
- Throws:
IOException
-
beginTransaction
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 interfacePersistenceAdapter
-
commitTransaction
Description copied from interface:PersistenceAdapterCommit a persistence transaction- Specified by:
commitTransactionin interfacePersistenceAdapter- See Also:
-
rollbackTransaction
Description copied from interface:PersistenceAdapterRollback a persistence transaction- Specified by:
rollbackTransactionin interfacePersistenceAdapter- See Also:
-
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
getLastMessageBrokerSequenceId
- Specified by:
getLastMessageBrokerSequenceIdin interfacePersistenceAdapter- Returns:
- last broker sequence
- Throws:
IOException
-
deleteAllMessages
Description copied from interface:PersistenceAdapterDelete's all the messages in the persistent store.- Specified by:
deleteAllMessagesin interfacePersistenceAdapter- Throws:
IOException
-
isUseExternalMessageReferences
public boolean isUseExternalMessageReferences() -
setUseExternalMessageReferences
public void setUseExternalMessageReferences(boolean useExternalMessageReferences) -
asMemoryMessageStore
-
setUsageManager
- Specified by:
setUsageManagerin interfacePersistenceAdapter- Parameters:
usageManager- The UsageManager that is controlling the broker's memory usage.
-
toString
-
setBrokerName
Description copied from interface:PersistenceAdapterSet the name of the broker using the adapter- Specified by:
setBrokerNamein interfacePersistenceAdapter
-
setDirectory
Description copied from interface:PersistenceAdapterSet the directory where any data files should be created- Specified by:
setDirectoryin interfacePersistenceAdapter
-
getDirectory
- Specified by:
getDirectoryin interfacePersistenceAdapter- Returns:
- the directory used by the persistence adaptor
-
checkpoint
Description copied from interface:PersistenceAdaptercheckpoint any- Specified by:
checkpointin interfacePersistenceAdapter- Throws:
IOException
-
size
public long size()Description copied from interface:PersistenceAdapterA hint to return the size of the store on disk- Specified by:
sizein interfacePersistenceAdapter- Returns:
- disk space used in bytes of 0 if not implemented
-
setCreateTransactionStore
- Throws:
IOException
-
getLastProducerSequenceId
public long getLastProducerSequenceId(org.apache.activemq.command.ProducerId id) 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 interfacePersistenceAdapter- Parameters:
id- the producerId to find a sequenceId for- Returns:
- the last stored sequence id or -1 if no suppression needed
-
allowIOResumption
public void allowIOResumption()- Specified by:
allowIOResumptionin interfacePersistenceAdapter
-
createJobSchedulerStore
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationExceptionDescription copied from interface:PersistenceAdapterCreates and returns a new Job Scheduler store instance.- Specified by:
createJobSchedulerStorein interfacePersistenceAdapter- 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.
-
isPersistNoLocal
public boolean isPersistNoLocal()- Specified by:
isPersistNoLocalin interfaceNoLocalSubscriptionAware
-
setBrokerService
- Specified by:
setBrokerServicein interfaceBrokerServiceAware
-