Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.store.journal
Class JournalMessageStore  view JournalMessageStore download JournalMessageStore.java

java.lang.Object
  extended byorg.activemq.store.journal.JournalMessageStore
All Implemented Interfaces:
org.activemq.store.cache.CacheMessageStoreAware, org.activemq.store.MessageStore, org.activemq.service.Service
Direct Known Subclasses:
JournalTopicMessageStore

public class JournalMessageStore
extends java.lang.Object
implements org.activemq.store.MessageStore, org.activemq.store.cache.CacheMessageStoreAware

A MessageStore that uses a Journal to store it's messages.

Version:
$Revision: 1.1 $

Field Summary
private  java.util.LinkedHashMap addedMessageIds
           
private  org.activemq.store.MessageStore cacheMessageStore
          A MessageStore that we can use to retreive messages quickly.
private  java.util.LinkedHashMap cpAddedMessageIds
           
protected  java.lang.String destinationName
           
protected  java.util.HashSet inFlightTxLocations
           
protected  RecordLocation lastLocation
           
private static org.apache.commons.logging.Log log
           
protected  org.activemq.store.MessageStore longTermStore
           
protected  JournalPersistenceAdapter peristenceAdapter
           
(package private)  int removedFromJournal
           
private  java.util.ArrayList removedMessageLocations
           
protected  JournalTransactionStore transactionStore
           
protected  org.activemq.util.TransactionTemplate transactionTemplate
           
 
Constructor Summary
JournalMessageStore(JournalPersistenceAdapter adapter, org.activemq.store.MessageStore checkpointStore, java.lang.String destinationName)
           
 
Method Summary
 void addMessage(org.activemq.message.ActiveMQMessage message)
          Not synchronized since the Journal has better throughput if you increase the number of conncurrent writes that it is doing.
private  void addMessage(org.activemq.message.ActiveMQMessage message, RecordLocation location)
           
 RecordLocation checkpoint()
           
private  org.activemq.message.ActiveMQMessage getCacheMessage(org.activemq.service.MessageIdentity identity)
           
 org.activemq.store.MessageStore getLongTermMessageStore()
           
 org.activemq.message.ActiveMQMessage getMessage(org.activemq.service.MessageIdentity identity)
          Looks up a message using either the String messageID or the messageNumber.
 void recover(org.activemq.store.RecoveryListener listener)
          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 removeAllMessages()
          Removes all the messages from the message store.
 void removeMessage(org.activemq.message.MessageAck ack)
          Removes a message from the message store.
private  void removeMessage(org.activemq.message.MessageAck ack, RecordLocation location)
           
 void replayAddMessage(org.activemq.message.ActiveMQMessage msg)
           
 void replayRemoveMessage(org.activemq.message.MessageAck ack)
           
 void setCacheMessageStore(org.activemq.store.cache.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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

peristenceAdapter

protected final JournalPersistenceAdapter peristenceAdapter

longTermStore

protected final org.activemq.store.MessageStore longTermStore

destinationName

protected final java.lang.String destinationName

transactionTemplate

protected final org.activemq.util.TransactionTemplate transactionTemplate

addedMessageIds

private java.util.LinkedHashMap addedMessageIds

removedMessageLocations

private java.util.ArrayList removedMessageLocations

inFlightTxLocations

protected java.util.HashSet inFlightTxLocations

lastLocation

protected RecordLocation lastLocation

cacheMessageStore

private org.activemq.store.MessageStore cacheMessageStore
A MessageStore that we can use to retreive messages quickly.


transactionStore

protected final JournalTransactionStore transactionStore

cpAddedMessageIds

private java.util.LinkedHashMap cpAddedMessageIds

removedFromJournal

int removedFromJournal
Constructor Detail

JournalMessageStore

public JournalMessageStore(JournalPersistenceAdapter adapter,
                           org.activemq.store.MessageStore checkpointStore,
                           java.lang.String destinationName)
Method Detail

addMessage

public void addMessage(org.activemq.message.ActiveMQMessage message)
                throws javax.jms.JMSException
Not synchronized since the Journal has better throughput if you increase the number of conncurrent writes that it is doing.

Specified by:
addMessage in interface org.activemq.store.MessageStore

addMessage

private void addMessage(org.activemq.message.ActiveMQMessage message,
                        RecordLocation location)

removeMessage

public void removeMessage(org.activemq.message.MessageAck ack)
                   throws javax.jms.JMSException
Description copied from interface: org.activemq.store.MessageStore
Removes a message from the message store.

Specified by:
removeMessage in interface org.activemq.store.MessageStore

removeMessage

private void removeMessage(org.activemq.message.MessageAck ack,
                           RecordLocation location)

checkpoint

public RecordLocation checkpoint()
                          throws javax.jms.JMSException

getCacheMessage

private org.activemq.message.ActiveMQMessage getCacheMessage(org.activemq.service.MessageIdentity identity)
                                                      throws javax.jms.JMSException

getMessage

public org.activemq.message.ActiveMQMessage getMessage(org.activemq.service.MessageIdentity identity)
                                                throws javax.jms.JMSException
Description copied from interface: org.activemq.store.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 org.activemq.store.MessageStore

recover

public void recover(org.activemq.store.RecoveryListener listener)
             throws javax.jms.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 org.activemq.store.MessageStore

start

public void start()
           throws javax.jms.JMSException
Description copied from interface: org.activemq.service.Service
Called to start the service

Specified by:
start in interface org.activemq.service.Service

stop

public void stop()
          throws javax.jms.JMSException
Description copied from interface: org.activemq.service.Service
Called to shutdown the service

Specified by:
stop in interface org.activemq.service.Service

getLongTermMessageStore

public org.activemq.store.MessageStore getLongTermMessageStore()

setCacheMessageStore

public void setCacheMessageStore(org.activemq.store.cache.CacheMessageStore store)
Specified by:
setCacheMessageStore in interface org.activemq.store.cache.CacheMessageStoreAware

removeAllMessages

public void removeAllMessages()
                       throws javax.jms.JMSException
Description copied from interface: org.activemq.store.MessageStore
Removes all the messages from the message store.

Specified by:
removeAllMessages in interface org.activemq.store.MessageStore

replayAddMessage

public void replayAddMessage(org.activemq.message.ActiveMQMessage msg)

replayRemoveMessage

public void replayRemoveMessage(org.activemq.message.MessageAck ack)