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.howl
Class HowlMessageStore

    java.lang.Object
      org.codehaus.activemq.store.howl.HowlMessageStore

All Implemented Interfaces:
  MessageStore, Service

public class HowlMessageStore
extends Object
implements MessageStore

An implementation of `MessageStore` designed for optimal use with Howl as the transaction log and then checkpointing asynchronously on a timeout with some other persistent storage.

Version:
  $Revision: 1.3 $

Constructor Summary
`HowlMessageStore(HowlPersistenceAdapter adapter, MessageStore checkpointStore, org.objectweb.howl.log.Logger transactionLog, WireFormat wireFormat)`

Method Summary
`MessageIdentity` | `addMessage(ActiveMQMessage message)` This method is synchronized to ensure that only 1 thread can write to the log and cache and possibly checkpoint at once, to preserve order across the transaction log, cache and checkpointStore.
`protected boolean` | `addMessageToCache(ActiveMQMessage message)` Adds the given message to the cache if there is spare capacity
`void` | `checkpoint()` Writes the current RAM cache to the long term, checkpoint store so that the transaction log can be truncated.
`protected void` | `checkpoint(ActiveMQMessage message)` Writes the current RAM image of the transaction log to stable, checkpoint store
`protected JMSException` | `createRecoveryFailedException(Exception e)`
`protected JMSException` | `createWriteException(Packet packet, Exception e)`
`int` | `getMaximumCacheSize()`
`ActiveMQMessage` | `getMessage(MessageIdentity identity)` Lets ensure that readers don't block writers so there only synchronization on the cache and checkpointStore.
`protected void` | `readPacket(org.objectweb.howl.log.LogRecord logRecord, QueueMessageContainer container)`
`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)` Removes can be done in any order so we only synchronize on the cache and checkpointStore
`void` | `setMaximumCacheSize(int maximumCacheSize)`
`void` | `start()` Called to start the service
`void` | `stop()` Called to shutdown the service
`protected void` | `writePacket(Packet packet)` Writes a message to the transaction log using the current sync mode

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

Constructor Detail

### HowlMessageStore

    public HowlMessageStore(HowlPersistenceAdapter adapter,
                            MessageStore checkpointStore,
                            org.objectweb.howl.log.Logger transactionLog,
                            WireFormat wireFormat)

Method Detail

### addMessage

    public MessageIdentity addMessage(ActiveMQMessage message)
                               throws JMSException

  This method is synchronized to ensure that only 1 thread can write to the log and cache and possibly checkpoint at once, to preserve order across the transaction log, cache and checkpointStore.

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

### getMessage

    public ActiveMQMessage getMessage(MessageIdentity identity)
                               throws JMSException

  Lets ensure that readers don't block writers so there only synchronization on the cache and checkpointStore.

  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`

### removeMessage

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

  Removes can be done in any order so we only synchronize on the cache and checkpointStore

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

### checkpoint

    public void checkpoint()
                    throws JMSException

  Writes the current RAM cache to the long term, checkpoint store so that the transaction log can be truncated.

  Throws:
    `JMSException`

### getMaximumCacheSize

    public int getMaximumCacheSize()

### setMaximumCacheSize

    public void setMaximumCacheSize(int maximumCacheSize)

### checkpoint

    protected void checkpoint(ActiveMQMessage message)
                       throws JMSException

  Writes the current RAM image of the transaction log to stable, checkpoint store

  Parameters:
    `message` - is an optional message. This is null for timer based checkpoints or is the message which cannot fit into the cache if cache-exhaustion based checkpoints
  Throws:
    `JMSException`

### addMessageToCache

    protected boolean addMessageToCache(ActiveMQMessage message)

  Adds the given message to the cache if there is spare capacity

  Parameters:
    `message` -
  Returns:
    true if the message was added to the cache or false

### readPacket

    protected void readPacket(org.objectweb.howl.log.LogRecord logRecord,
                              QueueMessageContainer container)

### writePacket

    protected void writePacket(Packet packet)
                        throws JMSException

  Writes a message to the transaction log using the current sync mode

  Throws:
    `JMSException`

### createRecoveryFailedException

    protected JMSException createRecoveryFailedException(Exception e)

### createWriteException

    protected JMSException createWriteException(Packet packet,
                                                Exception e)

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.