org.codehaus.activemq.store.howl
Class HowlPersistenceAdapter

java.lang.Object
  extended byorg.codehaus.activemq.service.impl.PersistenceAdapterSupport
      extended byorg.codehaus.activemq.store.howl.HowlPersistenceAdapter
All Implemented Interfaces:
PersistenceAdapter, Service

public class HowlPersistenceAdapter
extends PersistenceAdapterSupport

An implementation of PersistenceAdapter 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.7 $

Constructor Summary
HowlPersistenceAdapter()
           
HowlPersistenceAdapter(File directory, PersistenceAdapter longTermPersistence)
           
 
Method Summary
 void beginTransaction()
          This method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimisation.
 void commitTransaction()
          Commit a persistence transaction
protected  org.objectweb.howl.log.Configuration createConfiguration()
           
 PreparedTransactionStore createPreparedTransactionStore()
          Factory method to create a new persistent prepared transaction store for XA recovery
 MessageStore createQueueMessageStore(String destinationName)
          Factory method to create a new queue message store with the given destination name
 TopicMessageStore createTopicMessageStore(String destinationName)
          Factory method to create a new topic message store with the given destination name
protected  org.objectweb.howl.log.Logger createTransactionLog()
           
 String getBufferClassName()
           
 int getBufferSize()
           
 org.objectweb.howl.log.Configuration getConfiguration()
           
 File getDirectory()
           
 int getFlushSleepTime()
           
 Map getInitialDestinations()
          Returns a map, indexed by String name, of all the Destination objects active on startup.
 String getLogFileDir()
           
 String getLogFileExt()
           
 String getLogFileName()
           
 PersistenceAdapter getLongTermPersistence()
           
 int getMaxBlocksPerFile()
           
 int getMaxBuffers()
           
 int getMaximumCachedMessagesPerStore()
           
 int getMaximumTotalCachedMessages()
           
 int getMaxLogFiles()
           
 int getMinBuffers()
           
 int getThreadsWaitingForceThreshold()
           
 org.objectweb.howl.log.Logger getTransactionLog()
           
 boolean hasCacheCapacity(HowlMessageStore messageStore)
          Return true if a store is allowed to cache a message.
 boolean isChecksumEnabled()
           
static HowlPersistenceAdapter newInstance(File directory)
          Factory method to create an instance using the defaults
 void onMessageRemove(HowlMessageStore messageStore)
           
 void rollbackTransaction()
          Rollback a persistence transaction
 void setBufferClassName(String s)
           
 void setBufferSize(int i)
           
 void setChecksumEnabled(boolean b)
           
 void setConfiguration(org.objectweb.howl.log.Configuration configuration)
           
 void setDirectory(File directory)
           
 void setFlushSleepTime(int i)
           
 void setLogFileDir(String s)
           
 void setLogFileExt(String s)
           
 void setLogFileName(String s)
           
 void setLongTermPersistence(PersistenceAdapter longTermPersistence)
           
 void setMaxBlocksPerFile(int i)
           
 void setMaxBuffers(int i)
           
 void setMaximumCachedMessagesPerStore(int maximumCachedMessagesPerStore)
           
 void setMaximumTotalCachedMessages(int maximumTotalCachedMessages)
           
 void setMaxLogFiles(int i)
           
 void setMinBuffers(int i)
           
 void setThreadsWaitingForceThreshold(int i)
           
 void setTransactionLog(org.objectweb.howl.log.Logger transactionLog)
           
 void start()
          Called to start the service
 void stop()
          Called to shutdown the service
 
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
 

Constructor Detail

HowlPersistenceAdapter

public HowlPersistenceAdapter()

HowlPersistenceAdapter

public HowlPersistenceAdapter(File directory,
                              PersistenceAdapter longTermPersistence)
Method Detail

newInstance

public static HowlPersistenceAdapter newInstance(File directory)
                                          throws JMSException
Factory method to create an instance using the defaults

Parameters:
directory - the directory in which to store the persistent files
Returns:
Throws:
JMSException

getInitialDestinations

public Map getInitialDestinations()
Description copied from interface: PersistenceAdapter
Returns a map, indexed by String name, of all the Destination objects active on startup.

Returns:

createQueueMessageStore

public MessageStore createQueueMessageStore(String destinationName)
                                     throws JMSException
Description copied from interface: PersistenceAdapter
Factory method to create a new queue message store with the given destination name

Throws:
JMSException

createTopicMessageStore

public TopicMessageStore createTopicMessageStore(String destinationName)
                                          throws JMSException
Description copied from interface: PersistenceAdapter
Factory method to create a new topic message store with the given destination name

Throws:
JMSException

createPreparedTransactionStore

public PreparedTransactionStore createPreparedTransactionStore()
                                                        throws JMSException
Description copied from interface: PersistenceAdapter
Factory method to create a new persistent prepared transaction store for XA recovery

Throws:
JMSException

beginTransaction

public void beginTransaction()
                      throws JMSException
Description copied from interface: PersistenceAdapter
This method starts a transaction on the persistent storage - which is nothing to do with JMS or XA transactions - its purely a mechanism to perform multiple writes to a persistent store in 1 transaction as a performance optimisation.

Typically one transaction will require one disk synchronization point and so for real high performance its usually faster to perform many writes within the same transaction to minimise latency caused by disk synchronization. This is especially true when using tools like Berkeley Db or embedded JDBC servers.

Throws:
JMSException

commitTransaction

public void commitTransaction()
                       throws JMSException
Description copied from interface: PersistenceAdapter
Commit a persistence transaction

Throws:
JMSException
See Also:
PersistenceAdapter.beginTransaction()

rollbackTransaction

public void rollbackTransaction()
Description copied from interface: PersistenceAdapter
Rollback a persistence transaction

See Also:
PersistenceAdapter.beginTransaction()

start

public void start()
           throws JMSException
Description copied from interface: Service
Called to start the service

Throws:
JMSException

stop

public void stop()
          throws JMSException
Description copied from interface: Service
Called to shutdown the service

Throws:
JMSException

hasCacheCapacity

public boolean hasCacheCapacity(HowlMessageStore messageStore)
Return true if a store is allowed to cache a message. Called by a store when its about to store a message in its cache.

Parameters:
messageStore -
Returns:
true if the cache is allowed to cache the mesage

onMessageRemove

public void onMessageRemove(HowlMessageStore messageStore)

getLongTermPersistence

public PersistenceAdapter getLongTermPersistence()

setLongTermPersistence

public void setLongTermPersistence(PersistenceAdapter longTermPersistence)

getMaximumCachedMessagesPerStore

public int getMaximumCachedMessagesPerStore()

setMaximumCachedMessagesPerStore

public void setMaximumCachedMessagesPerStore(int maximumCachedMessagesPerStore)

getMaximumTotalCachedMessages

public int getMaximumTotalCachedMessages()

setMaximumTotalCachedMessages

public void setMaximumTotalCachedMessages(int maximumTotalCachedMessages)

getDirectory

public File getDirectory()

setDirectory

public void setDirectory(File directory)

getConfiguration

public org.objectweb.howl.log.Configuration getConfiguration()
                                                      throws org.objectweb.howl.log.LogConfigurationException,
                                                             IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setConfiguration

public void setConfiguration(org.objectweb.howl.log.Configuration configuration)

getTransactionLog

public org.objectweb.howl.log.Logger getTransactionLog()

setTransactionLog

public void setTransactionLog(org.objectweb.howl.log.Logger transactionLog)

getBufferClassName

public String getBufferClassName()
                          throws org.objectweb.howl.log.LogConfigurationException,
                                 IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getBufferSize

public int getBufferSize()
                  throws org.objectweb.howl.log.LogConfigurationException,
                         IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getFlushSleepTime

public int getFlushSleepTime()
                      throws org.objectweb.howl.log.LogConfigurationException,
                             IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getLogFileDir

public String getLogFileDir()
                     throws org.objectweb.howl.log.LogConfigurationException,
                            IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getLogFileExt

public String getLogFileExt()
                     throws org.objectweb.howl.log.LogConfigurationException,
                            IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getLogFileName

public String getLogFileName()
                      throws org.objectweb.howl.log.LogConfigurationException,
                             IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getMaxBlocksPerFile

public int getMaxBlocksPerFile()
                        throws org.objectweb.howl.log.LogConfigurationException,
                               IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getMaxBuffers

public int getMaxBuffers()
                  throws org.objectweb.howl.log.LogConfigurationException,
                         IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getMaxLogFiles

public int getMaxLogFiles()
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getMinBuffers

public int getMinBuffers()
                  throws org.objectweb.howl.log.LogConfigurationException,
                         IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

getThreadsWaitingForceThreshold

public int getThreadsWaitingForceThreshold()
                                    throws org.objectweb.howl.log.LogConfigurationException,
                                           IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

isChecksumEnabled

public boolean isChecksumEnabled()
                          throws org.objectweb.howl.log.LogConfigurationException,
                                 IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setBufferClassName

public void setBufferClassName(String s)
                        throws org.objectweb.howl.log.LogConfigurationException,
                               IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setBufferSize

public void setBufferSize(int i)
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setChecksumEnabled

public void setChecksumEnabled(boolean b)
                        throws org.objectweb.howl.log.LogConfigurationException,
                               IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setFlushSleepTime

public void setFlushSleepTime(int i)
                       throws org.objectweb.howl.log.LogConfigurationException,
                              IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setLogFileDir

public void setLogFileDir(String s)
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setLogFileExt

public void setLogFileExt(String s)
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setLogFileName

public void setLogFileName(String s)
                    throws org.objectweb.howl.log.LogConfigurationException,
                           IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setMaxBlocksPerFile

public void setMaxBlocksPerFile(int i)
                         throws org.objectweb.howl.log.LogConfigurationException,
                                IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setMaxBuffers

public void setMaxBuffers(int i)
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setMaxLogFiles

public void setMaxLogFiles(int i)
                    throws org.objectweb.howl.log.LogConfigurationException,
                           IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setMinBuffers

public void setMinBuffers(int i)
                   throws org.objectweb.howl.log.LogConfigurationException,
                          IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

setThreadsWaitingForceThreshold

public void setThreadsWaitingForceThreshold(int i)
                                     throws org.objectweb.howl.log.LogConfigurationException,
                                            IOException
Throws:
org.objectweb.howl.log.LogConfigurationException
IOException

createTransactionLog

protected org.objectweb.howl.log.Logger createTransactionLog()
                                                      throws IOException,
                                                             org.objectweb.howl.log.LogConfigurationException
Throws:
IOException
org.objectweb.howl.log.LogConfigurationException

createConfiguration

protected org.objectweb.howl.log.Configuration createConfiguration()
                                                            throws IOException,
                                                                   org.objectweb.howl.log.LogConfigurationException
Throws:
IOException
org.objectweb.howl.log.LogConfigurationException


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