org.apache.qpid.server.store
Class MemoryMessageStore

java.lang.Object
  extended by org.apache.qpid.server.store.MemoryMessageStore
All Implemented Interfaces:
MessageStore

public class MemoryMessageStore
extends java.lang.Object
implements MessageStore

A simple message store that stores the messages in a threadsafe structure in memory.


Field Summary
protected  java.util.concurrent.ConcurrentMap<java.lang.Long,AMQMessage> _messageMap
           
 
Constructor Summary
MemoryMessageStore()
           
 
Method Summary
 void abortTran()
           
 void beginTran()
           
 void close()
          Called to close and cleanup any resources used by the message store.
 void commitTran()
           
 void configure()
           
 void configure(QueueRegistry queueRegistry, java.lang.String base, org.apache.commons.configuration.Configuration config)
          Called after instantiation in order to configure the message store.
 void configure(java.lang.String base, org.apache.commons.configuration.Configuration config)
           
 void createQueue(AMQQueue queue)
           
 java.util.List<AMQQueue> createQueues()
          Recreate all queues that were persisted, including re-enqueuing of existing messages
 void dequeueMessage(java.lang.String name, long messageId)
           
 void enqueueMessage(java.lang.String name, long messageId)
           
 AMQMessage getMessage(long messageId)
           
 long getNewMessageId()
          Return a valid, currently unused message id.
 boolean inTran()
           
 void put(AMQMessage msg)
           
 void removeMessage(long messageId)
           
 void removeQueue(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_messageMap

protected java.util.concurrent.ConcurrentMap<java.lang.Long,AMQMessage> _messageMap
Constructor Detail

MemoryMessageStore

public MemoryMessageStore()
Method Detail

configure

public void configure()

configure

public void configure(java.lang.String base,
                      org.apache.commons.configuration.Configuration config)

configure

public void configure(QueueRegistry queueRegistry,
                      java.lang.String base,
                      org.apache.commons.configuration.Configuration config)
               throws java.lang.Exception
Description copied from interface: MessageStore
Called after instantiation in order to configure the message store. A particular implementation can define whatever parameters it wants.

Specified by:
configure in interface MessageStore
Parameters:
queueRegistry - the registry of queues to be used by this store
base - the base element identifier from which all configuration items are relative. For example, if the base element is "store", the all elements used by concrete classes will be "store.foo" etc.
config - the apache commons configuration object
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Description copied from interface: MessageStore
Called to close and cleanup any resources used by the message store.

Specified by:
close in interface MessageStore
Throws:
java.lang.Exception

put

public void put(AMQMessage msg)
Specified by:
put in interface MessageStore

removeMessage

public void removeMessage(long messageId)
Specified by:
removeMessage in interface MessageStore

createQueue

public void createQueue(AMQQueue queue)
                 throws org.apache.qpid.AMQException
Specified by:
createQueue in interface MessageStore
Throws:
org.apache.qpid.AMQException

removeQueue

public void removeQueue(java.lang.String name)
                 throws org.apache.qpid.AMQException
Specified by:
removeQueue in interface MessageStore
Throws:
org.apache.qpid.AMQException

enqueueMessage

public void enqueueMessage(java.lang.String name,
                           long messageId)
                    throws org.apache.qpid.AMQException
Specified by:
enqueueMessage in interface MessageStore
Throws:
org.apache.qpid.AMQException

dequeueMessage

public void dequeueMessage(java.lang.String name,
                           long messageId)
                    throws org.apache.qpid.AMQException
Specified by:
dequeueMessage in interface MessageStore
Throws:
org.apache.qpid.AMQException

beginTran

public void beginTran()
               throws org.apache.qpid.AMQException
Specified by:
beginTran in interface MessageStore
Throws:
org.apache.qpid.AMQException

commitTran

public void commitTran()
                throws org.apache.qpid.AMQException
Specified by:
commitTran in interface MessageStore
Throws:
org.apache.qpid.AMQException

abortTran

public void abortTran()
               throws org.apache.qpid.AMQException
Specified by:
abortTran in interface MessageStore
Throws:
org.apache.qpid.AMQException

inTran

public boolean inTran()
Specified by:
inTran in interface MessageStore

createQueues

public java.util.List<AMQQueue> createQueues()
                                      throws org.apache.qpid.AMQException
Description copied from interface: MessageStore
Recreate all queues that were persisted, including re-enqueuing of existing messages

Specified by:
createQueues in interface MessageStore
Returns:
Throws:
org.apache.qpid.AMQException

getNewMessageId

public long getNewMessageId()
Description copied from interface: MessageStore
Return a valid, currently unused message id.

Specified by:
getNewMessageId in interface MessageStore
Returns:
a message id

getMessage

public AMQMessage getMessage(long messageId)