Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.store.cache
Class CacheMessageStore

    java.lang.Object
      org.codehaus.activemq.store.cache.CacheMessageStore

All Implemented Interfaces:
  CacheMessageStoreAware, MessageStore, Service

Direct Known Subclasses:
  CacheTopicMessageStore

public class CacheMessageStore
extends Object
implements MessageStore, CacheMessageStoreAware

A MessageStore that uses an in memory cache to speed up getMessage() method calls.

Version:
  $Revision: 1.2 $

Constructor Summary
`CacheMessageStore(CachePersistenceAdapter adapter, MessageStore longTermStore, MessageCache cache)`

Method Summary
`MessageIdentity` | `addMessage(ActiveMQMessage message)` Add the meessage to the long term store and cache it.
`MessageStore` | `getLongTermStore()`
`ActiveMQMessage` | `getMessage(MessageIdentity identity)` Return the message from the cache or go to the longTermStore if it is not in there.
`void` | `recover(QueueMessageContainer container)` Replays the checkpointStore first as those messages are the oldest ones, then messages are replayed from the transaction log and then the cache is updated.
`void` | `removeMessage(MessageIdentity identity, MessageAck ack)` Remove the meessage to the long term store and remove it from the cache.
`void` | `setCacheMessageStore(CacheMessageStore store)`
`void` | `start()` Called to start the service
`void` | `stop()` Called to shutdown the service

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CacheMessageStore

    public CacheMessageStore(CachePersistenceAdapter adapter,
                             MessageStore longTermStore,
                             MessageCache cache)

Method Detail

### addMessage

    public MessageIdentity addMessage(ActiveMQMessage message)
                               throws JMSException

  Add the meessage to the long term store and cache it.

  Specified by:
    `addMessage` in interface `MessageStore`
  Throws:
    `JMSException`

### removeMessage

    public void removeMessage(MessageIdentity identity,
                              MessageAck ack)
                       throws JMSException

  Remove the meessage to the long term store and remove it from the cache.

  Specified by:
    `removeMessage` in interface `MessageStore`
  Throws:
    `JMSException`

### getMessage

    public ActiveMQMessage getMessage(MessageIdentity identity)
                               throws JMSException

  Return the message from the cache or go to the longTermStore if it is not in there.

  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:
    `JMSException`

### recover

    public void recover(QueueMessageContainer container)
                 throws JMSException

  Replays the checkpointStore first as those messages are the oldest ones, then messages are replayed from the transaction log and then the cache is updated.

  Specified by:
    `recover` in interface `MessageStore`
  Parameters:
    `container` -
  Throws:
    `JMSException`

### start

    public void start()
               throws JMSException

  Description copied from interface: `Service`
  Called to start the service

  Specified by:
    `start` in interface `Service`
  Throws:
    `JMSException`

### stop

    public void stop()
              throws JMSException

  Description copied from interface: `Service`
  Called to shutdown the service

  Specified by:
    `stop` in interface `Service`
  Throws:
    `JMSException`

### getLongTermStore

    public MessageStore getLongTermStore()

  Returns:
    Returns the longTermStore.

### setCacheMessageStore

    public void setCacheMessageStore(CacheMessageStore store)

  Specified by:
    `setCacheMessageStore` in interface `CacheMessageStoreAware`
  See Also:
    `CacheMessageStoreAware.setCacheMessageStore(org.codehaus.activemq.store.cache.CacheMessageStore)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.