org.codehaus.activemq.store.journal
Class JournalPersistenceAdapter

java.lang.Object
  extended byorg.codehaus.activemq.service.impl.PersistenceAdapterSupport
      extended byorg.codehaus.activemq.store.journal.JournalPersistenceAdapter
All Implemented Interfaces:
org.codehaus.activemq.journal.JournalEventListener, org.codehaus.activemq.store.PersistenceAdapter, org.codehaus.activemq.service.Service

public class JournalPersistenceAdapter
extends org.codehaus.activemq.service.impl.PersistenceAdapterSupport
implements org.codehaus.activemq.journal.JournalEventListener

An implementation of PersistenceAdapter designed for use with a Journal and then checkpointing asynchronously on a timeout with some other long term persistent storage.

Version:
$Revision: 1.4 $

Field Summary
static String DEFAULT_JOURNAL_TYPE
           
static String HOWL_JOURNAL_TYPE
           
 
Constructor Summary
JournalPersistenceAdapter()
           
JournalPersistenceAdapter(File directory, org.codehaus.activemq.store.PersistenceAdapter longTermPersistence, org.codehaus.activemq.io.impl.DefaultWireFormat wireFormat)
           
 
Method Summary
 void beginTransaction()
           
 void checkpoint()
          When we checkpoint we move all the journaled data to long term storage.
 void commitTransaction()
           
protected  org.codehaus.activemq.journal.Journal createJournal()
           
 org.codehaus.activemq.store.PreparedTransactionStore createPreparedTransactionStore()
           
 org.codehaus.activemq.store.MessageStore createQueueMessageStore(String destinationName)
           
protected  JMSException createRecoveryFailedException(Exception e)
           
 org.codehaus.activemq.store.TopicMessageStore createTopicMessageStore(String destinationName)
           
protected  JMSException createWriteException(org.codehaus.activemq.message.Packet packet, Exception e)
           
protected  JMSException createWriteException(String command, Exception e)
           
 ClockDaemon getClockDaemon()
           
 File getDirectory()
           
 Map getInitialDestinations()
           
 String getJournalType()
           
 org.codehaus.activemq.store.PersistenceAdapter getLongTermPersistence()
           
 org.codehaus.activemq.io.WireFormat getWireFormat()
           
 boolean isSync()
           
 void overflowNotification(org.codehaus.activemq.journal.RecordLocation safeLocation)
          The Journal give us a call back so that we can move old data out of the journal.
 org.codehaus.activemq.message.Packet readPacket(org.codehaus.activemq.journal.RecordLocation location)
           
 void rollbackTransaction()
           
 void setClockDaemon(ClockDaemon clockDaemon)
           
 void setDirectory(File directory)
           
 void setJournalType(String journalType)
           
 void setLongTermPersistence(org.codehaus.activemq.store.PersistenceAdapter longTermPersistence)
           
 void setSync(boolean sync)
           
 void setWireFormat(org.codehaus.activemq.io.WireFormat wireFormat)
           
 void start()
           
 void stop()
           
 org.codehaus.activemq.journal.RecordLocation writeCommand(String command, boolean sync)
           
 org.codehaus.activemq.journal.RecordLocation writePacket(String destination, org.codehaus.activemq.message.Packet packet, boolean sync)
           
 
Methods inherited from class org.codehaus.activemq.service.impl.PersistenceAdapterSupport
createQueueMessageContainer, createTopicMessageContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JOURNAL_TYPE

public static final String DEFAULT_JOURNAL_TYPE
See Also:
Constant Field Values

HOWL_JOURNAL_TYPE

public static final String HOWL_JOURNAL_TYPE
See Also:
Constant Field Values
Constructor Detail

JournalPersistenceAdapter

public JournalPersistenceAdapter()

JournalPersistenceAdapter

public JournalPersistenceAdapter(File directory,
                                 org.codehaus.activemq.store.PersistenceAdapter longTermPersistence,
                                 org.codehaus.activemq.io.impl.DefaultWireFormat wireFormat)
                          throws IOException
Method Detail

getInitialDestinations

public Map getInitialDestinations()
Specified by:
getInitialDestinations in interface org.codehaus.activemq.store.PersistenceAdapter

createQueueMessageStore

public org.codehaus.activemq.store.MessageStore createQueueMessageStore(String destinationName)
                                                                 throws JMSException
Specified by:
createQueueMessageStore in interface org.codehaus.activemq.store.PersistenceAdapter
Throws:
JMSException

createTopicMessageStore

public org.codehaus.activemq.store.TopicMessageStore createTopicMessageStore(String destinationName)
                                                                      throws JMSException
Specified by:
createTopicMessageStore in interface org.codehaus.activemq.store.PersistenceAdapter
Throws:
JMSException

createPreparedTransactionStore

public org.codehaus.activemq.store.PreparedTransactionStore createPreparedTransactionStore()
                                                                                    throws JMSException
Specified by:
createPreparedTransactionStore in interface org.codehaus.activemq.store.PersistenceAdapter
Throws:
JMSException

beginTransaction

public void beginTransaction()
                      throws JMSException
Specified by:
beginTransaction in interface org.codehaus.activemq.store.PersistenceAdapter
Throws:
JMSException

commitTransaction

public void commitTransaction()
                       throws JMSException
Specified by:
commitTransaction in interface org.codehaus.activemq.store.PersistenceAdapter
Throws:
JMSException

rollbackTransaction

public void rollbackTransaction()
Specified by:
rollbackTransaction in interface org.codehaus.activemq.store.PersistenceAdapter

start

public void start()
           throws JMSException
Specified by:
start in interface org.codehaus.activemq.service.Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
Specified by:
stop in interface org.codehaus.activemq.service.Service
Throws:
JMSException

getLongTermPersistence

public org.codehaus.activemq.store.PersistenceAdapter getLongTermPersistence()

setLongTermPersistence

public void setLongTermPersistence(org.codehaus.activemq.store.PersistenceAdapter longTermPersistence)

getDirectory

public File getDirectory()
Returns:
Returns the directory.

setDirectory

public void setDirectory(File directory)
Parameters:
directory - The directory to set.

isSync

public boolean isSync()
Returns:
Returns the sync.

setSync

public void setSync(boolean sync)
Parameters:
sync - The sync to set.

getWireFormat

public org.codehaus.activemq.io.WireFormat getWireFormat()
Returns:
Returns the wireFormat.

setWireFormat

public void setWireFormat(org.codehaus.activemq.io.WireFormat wireFormat)
Parameters:
wireFormat - The wireFormat to set.

getJournalType

public String getJournalType()

setJournalType

public void setJournalType(String journalType)

createJournal

protected org.codehaus.activemq.journal.Journal createJournal()
                                                       throws IOException
Throws:
IOException

overflowNotification

public void overflowNotification(org.codehaus.activemq.journal.RecordLocation safeLocation)
The Journal give us a call back so that we can move old data out of the journal. Taking a checkpoint does this for us.

Specified by:
overflowNotification in interface org.codehaus.activemq.journal.JournalEventListener
See Also:
JournalEventListener.overflowNotification(org.codehaus.activemq.journal.RecordLocation)

checkpoint

public void checkpoint()
When we checkpoint we move all the journaled data to long term storage.


writePacket

public org.codehaus.activemq.journal.RecordLocation writePacket(String destination,
                                                                org.codehaus.activemq.message.Packet packet,
                                                                boolean sync)
                                                         throws JMSException
Parameters:
sync -
Throws:
JMSException

writeCommand

public org.codehaus.activemq.journal.RecordLocation writeCommand(String command,
                                                                 boolean sync)
                                                          throws JMSException
Parameters:
sync -
Throws:
JMSException

readPacket

public org.codehaus.activemq.message.Packet readPacket(org.codehaus.activemq.journal.RecordLocation location)
                                                throws JMSException
Parameters:
location -
Returns:
Throws:
JMSException

createWriteException

protected JMSException createWriteException(org.codehaus.activemq.message.Packet packet,
                                            Exception e)

createWriteException

protected JMSException createWriteException(String command,
                                            Exception e)

createRecoveryFailedException

protected JMSException createRecoveryFailedException(Exception e)

getClockDaemon

public ClockDaemon getClockDaemon()

setClockDaemon

public void setClockDaemon(ClockDaemon clockDaemon)


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