org.apache.activemq.store.kahadaptor
Class KahaReferenceStore

java.lang.Object
  extended by org.apache.activemq.store.AbstractMessageStore
      extended by org.apache.activemq.store.kahadaptor.KahaReferenceStore
All Implemented Interfaces:
Service, MessageStore, ReferenceStore
Direct Known Subclasses:
KahaTopicReferenceStore

public class KahaReferenceStore
extends AbstractMessageStore
implements ReferenceStore

Author:
rajdavies

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.activemq.store.ReferenceStore
ReferenceStore.ReferenceData
 
Field Summary
protected  KahaReferenceStoreAdapter adapter
           
protected  ActiveMQMessageAudit dispatchAudit
           
protected  Lock lock
           
protected  MapContainer<MessageId,ReferenceRecord> messageContainer
           
 
Fields inherited from class org.apache.activemq.store.AbstractMessageStore
destination, FUTURE, prioritizedMessages
 
Constructor Summary
KahaReferenceStore(KahaReferenceStoreAdapter adapter, MapContainer<MessageId,ReferenceRecord> container, ActiveMQDestination destination)
           
 
Method Summary
 void addMessage(ConnectionContext context, Message message)
          Adds a message to the message store
 boolean addMessageReference(ConnectionContext context, MessageId messageId, ReferenceStore.ReferenceData data)
          Adds a message reference to the message store
 void delete()
           
 void dispose(ConnectionContext context)
           
 Message getMessage(MessageId identity)
          Looks up a message using either the String messageID or the messageNumber.
 int getMessageCount()
           
protected  MessageId getMessageId(Object object)
           
 ReferenceStore.ReferenceData getMessageReference(MessageId identity)
          Looks up a message using either the String messageID or the messageNumber.
 Lock getStoreLock()
           
protected  boolean isDuplicate(MessageId messageId)
           
 boolean isSupportForCursors()
           
 void recover(MessageRecoveryListener listener)
          Recover any messages to be delivered.
 void recoverNextMessages(int maxReturned, MessageRecoveryListener listener)
           
protected  boolean recoverReference(MessageRecoveryListener listener, ReferenceRecord record)
           
 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 resetBatching()
          A hint to the Store to reset any batching state for the Destination
 void setBatch(MessageId startAfter)
          allow caching cursors to set the current batch offset when cache is exhausted
 boolean supportsExternalBatchControl()
           
 
Methods inherited from class org.apache.activemq.store.AbstractMessageStore
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, getDestination, isEmpty, isPrioritizedMessages, removeAsyncMessage, setMemoryUsage, setPrioritizedMessages, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.store.MessageStore
addMessage, asyncAddQueueMessage, asyncAddQueueMessage, asyncAddTopicMessage, asyncAddTopicMessage, getDestination, isEmpty, isPrioritizedMessages, removeAsyncMessage, setMemoryUsage, setPrioritizedMessages
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Field Detail

messageContainer

protected final MapContainer<MessageId,ReferenceRecord> messageContainer

adapter

protected KahaReferenceStoreAdapter adapter

dispatchAudit

protected ActiveMQMessageAudit dispatchAudit

lock

protected final Lock lock
Constructor Detail

KahaReferenceStore

public KahaReferenceStore(KahaReferenceStoreAdapter adapter,
                          MapContainer<MessageId,ReferenceRecord> container,
                          ActiveMQDestination destination)
                   throws IOException
Throws:
IOException
Method Detail

getStoreLock

public Lock getStoreLock()
Specified by:
getStoreLock in interface ReferenceStore

dispose

public void dispose(ConnectionContext context)
Specified by:
dispose in interface MessageStore
Overrides:
dispose in class AbstractMessageStore

getMessageId

protected MessageId getMessageId(Object object)

addMessage

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

Specified by:
addMessage in interface MessageStore
Parameters:
context - context
Throws:
IOException

getMessage

public Message getMessage(MessageId identity)
                   throws 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:
IOException

recoverReference

protected final boolean recoverReference(MessageRecoveryListener listener,
                                         ReferenceRecord record)
                                  throws Exception
Throws:
Exception

recover

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

Specified by:
recover in interface MessageStore
Throws:
Exception

recoverNextMessages

public void recoverNextMessages(int maxReturned,
                                MessageRecoveryListener listener)
                         throws Exception
Specified by:
recoverNextMessages in interface MessageStore
Throws:
Exception

addMessageReference

public boolean addMessageReference(ConnectionContext context,
                                   MessageId messageId,
                                   ReferenceStore.ReferenceData data)
                            throws IOException
Description copied from interface: ReferenceStore
Adds a message reference to the message store

Specified by:
addMessageReference in interface ReferenceStore
Returns:
true if reference was added, false if it is a duplicate and not added
Throws:
IOException

isDuplicate

protected boolean isDuplicate(MessageId messageId)

getMessageReference

public ReferenceStore.ReferenceData getMessageReference(MessageId identity)
                                                 throws IOException
Description copied from interface: ReferenceStore
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 ReferenceStore
Throws:
IOException

removeMessage

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

Specified by:
removeMessage in interface MessageStore
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:
IOException

removeAllMessages

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

Specified by:
removeAllMessages in interface MessageStore
Throws:
IOException

delete

public void delete()

resetBatching

public void resetBatching()
Description copied from interface: MessageStore
A hint to the Store to reset any batching state for the Destination

Specified by:
resetBatching in interface MessageStore

getMessageCount

public int getMessageCount()
Specified by:
getMessageCount in interface MessageStore
Returns:
the number of messages ready to deliver

isSupportForCursors

public boolean isSupportForCursors()

supportsExternalBatchControl

public boolean supportsExternalBatchControl()
Specified by:
supportsExternalBatchControl in interface ReferenceStore
Returns:
true if it supports external batch control

setBatch

public void setBatch(MessageId startAfter)
Description copied from interface: MessageStore
allow caching cursors to set the current batch offset when cache is exhausted

Specified by:
setBatch in interface MessageStore
Specified by:
setBatch in interface ReferenceStore
Overrides:
setBatch in class AbstractMessageStore
Parameters:
startAfter -
See Also:
ReferenceStore.setBatch(org.apache.activemq.command.MessageId)


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.