org.apache.activemq.store.memory
Class MemoryMessageStore

java.lang.Object
  extended by org.apache.activemq.store.memory.MemoryMessageStore
All Implemented Interfaces:
Service, MessageStore
Direct Known Subclasses:
MemoryTopicMessageStore

public class MemoryMessageStore
extends java.lang.Object
implements MessageStore

An implementation of MessageStore which uses a

Version:
$Revision: 1.7 $

Field Summary
protected  ActiveMQDestination destination
           
protected  java.util.Map messageTable
           
 
Constructor Summary
MemoryMessageStore(ActiveMQDestination destination)
           
MemoryMessageStore(ActiveMQDestination destination, java.util.Map messageTable)
           
 
Method Summary
 void addMessage(ConnectionContext context, Message message)
          Adds a message to the message store
 void addMessageReference(ConnectionContext context, MessageId messageId, long expirationTime, java.lang.String messageRef)
          Adds a message reference to the message store
 void delete()
           
 ActiveMQDestination getDestination()
          The destination that the message store is holding messages for.
 Message getMessage(MessageId identity)
          Looks up a message using either the String messageID or the messageNumber.
 java.lang.String getMessageReference(MessageId identity)
          Looks up a message using either the String messageID or the messageNumber.
 void recover(MessageRecoveryListener listener)
          Recover any messages to be delivered.
 void removeAllMessages(ConnectionContext context)
          Removes all the messages from the message store.
 void removeMessage(ConnectionContext context, MessageAck ack)
          Removes a message from the message store.
 void removeMessage(MessageId msgId)
           
 void setUsageManager(UsageManager usageManager)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destination

protected final ActiveMQDestination destination

messageTable

protected final java.util.Map messageTable
Constructor Detail

MemoryMessageStore

public MemoryMessageStore(ActiveMQDestination destination)

MemoryMessageStore

public MemoryMessageStore(ActiveMQDestination destination,
                          java.util.Map messageTable)
Method Detail

addMessage

public void addMessage(ConnectionContext context,
                       Message message)
                throws java.io.IOException
Description copied from interface: MessageStore
Adds a message to the message store

Specified by:
addMessage in interface MessageStore
Parameters:
context - TODO
Throws:
java.io.IOException

addMessageReference

public void addMessageReference(ConnectionContext context,
                                MessageId messageId,
                                long expirationTime,
                                java.lang.String messageRef)
                         throws java.io.IOException
Description copied from interface: MessageStore
Adds a message reference to the message store

Specified by:
addMessageReference in interface MessageStore
Parameters:
context - TODO
messageId - TODO
expirationTime - TODO
Throws:
java.io.IOException

getMessage

public Message getMessage(MessageId identity)
                   throws java.io.IOException
Description copied from interface: MessageStore
Looks up a message using either the String messageID or the messageNumber. Implementations are encouraged to fill in the missing key if its easy to do so.

Specified by:
getMessage in interface MessageStore
Parameters:
identity - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
java.io.IOException

getMessageReference

public java.lang.String getMessageReference(MessageId identity)
                                     throws java.io.IOException
Description copied from interface: MessageStore
Looks up a message using either the String messageID or the messageNumber. Implementations are encouraged to fill in the missing key if its easy to do so.

Specified by:
getMessageReference in interface MessageStore
Parameters:
identity - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
java.io.IOException

removeMessage

public void removeMessage(ConnectionContext context,
                          MessageAck ack)
                   throws java.io.IOException
Description copied from interface: MessageStore
Removes a message from the message store.

Specified by:
removeMessage in interface MessageStore
Parameters:
context - TODO
ack - the ack request that cause the message to be removed. It conatins the identity which contains the messageID of the message that needs to be removed.
Throws:
java.io.IOException

removeMessage

public void removeMessage(MessageId msgId)
                   throws java.io.IOException
Throws:
java.io.IOException

recover

public void recover(MessageRecoveryListener listener)
             throws java.lang.Exception
Description copied from interface: MessageStore
Recover any messages to be delivered.

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

start

public void start()
Specified by:
start in interface Service

stop

public void stop()
Specified by:
stop in interface Service

removeAllMessages

public void removeAllMessages(ConnectionContext context)
                       throws java.io.IOException
Description copied from interface: MessageStore
Removes all the messages from the message store.

Specified by:
removeAllMessages in interface MessageStore
Parameters:
context - TODO
Throws:
java.io.IOException

getDestination

public ActiveMQDestination getDestination()
Description copied from interface: MessageStore
The destination that the message store is holding messages for.

Specified by:
getDestination in interface MessageStore
Returns:

delete

public void delete()

setUsageManager

public void setUsageManager(UsageManager usageManager)
Specified by:
setUsageManager in interface MessageStore
Parameters:
usageManager - The UsageManager that is controlling the destination's memory usage.


Copyright © 2009 Apache Software Foundation. All Rights Reserved.