public class JournalPersistenceAdapter extends java.lang.Object implements PersistenceAdapter, org.apache.activeio.journal.JournalEventListener, UsageListener, BrokerServiceAware
PersistenceAdapter designed for use with a
Journal and then check pointing asynchronously on a timeout with some
other long term persistent storage.| Constructor and Description |
|---|
JournalPersistenceAdapter() |
JournalPersistenceAdapter(org.apache.activeio.journal.Journal journal,
PersistenceAdapter longTermPersistence,
TaskRunnerFactory taskRunnerFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTransaction(ConnectionContext context)
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 optimization.
|
void |
checkpoint(boolean sync)
checkpoint any
|
void |
checkpoint(boolean sync,
boolean fullCheckpoint)
When we checkpoint we move all the journalled data to long term storage.
|
void |
commitTransaction(ConnectionContext context)
Commit a persistence transaction
|
MessageStore |
createQueueMessageStore(ActiveMQQueue destination)
Factory method to create a new queue message store with the given destination name
|
protected java.io.IOException |
createRecoveryFailedException(java.lang.Exception e) |
TopicMessageStore |
createTopicMessageStore(ActiveMQTopic destinationName)
Factory method to create a new topic message store with the given destination name
|
TransactionStore |
createTransactionStore()
Factory method to create a new persistent prepared transaction store for XA recovery
|
protected java.io.IOException |
createWriteException(DataStructure packet,
java.lang.Exception e) |
protected java.io.IOException |
createWriteException(java.lang.String command,
java.lang.Exception e) |
void |
deleteAllMessages()
Delete's all the messages in the persistent store.
|
boolean |
doCheckpoint()
This does the actual checkpoint.
|
java.util.Set<ActiveMQDestination> |
getDestinations()
Returns a set of all the
ActiveMQDestination
objects that the persistence store is aware exist. |
java.io.File |
getDirectory() |
long |
getLastMessageBrokerSequenceId() |
long |
getLastProducerSequenceId(ProducerId id)
return the last stored producer sequenceId for this producer Id
used to suppress duplicate sends on failover reconnect at the transport
when a reconnect occurs
|
PersistenceAdapter |
getLongTermPersistence() |
int |
getMaxCheckpointMessageAddSize() |
int |
getMaxCheckpointWorkers() |
JournalTransactionStore |
getTransactionStore() |
SystemUsage |
getUsageManager() |
WireFormat |
getWireFormat() |
boolean |
isUseExternalMessageReferences() |
void |
onUsageChanged(Usage usage,
int oldPercentUsage,
int newPercentUsage) |
void |
overflowNotification(org.apache.activeio.journal.RecordLocation safeLocation)
The Journal give us a call back so that we can move old data out of the
journal.
|
DataStructure |
readCommand(org.apache.activeio.journal.RecordLocation location) |
void |
removeQueueMessageStore(ActiveMQQueue destination)
Cleanup method to remove any state associated with the given destination
|
void |
removeTopicMessageStore(ActiveMQTopic destination)
Cleanup method to remove any state associated with the given destination
|
void |
rollbackTransaction(ConnectionContext context)
Rollback a persistence transaction
|
void |
setBrokerName(java.lang.String brokerName)
Set the name of the broker using the adapter
|
void |
setBrokerService(BrokerService brokerService) |
void |
setDirectory(java.io.File dir)
Set the directory where any data files should be created
|
void |
setJournal(org.apache.activeio.journal.Journal journal) |
void |
setMaxCheckpointMessageAddSize(int maxCheckpointMessageAddSize) |
void |
setMaxCheckpointWorkers(int maxCheckpointWorkers) |
void |
setPersistenceAdapter(PersistenceAdapter longTermPersistence) |
void |
setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory) |
void |
setUsageManager(SystemUsage usageManager) |
void |
setUseExternalMessageReferences(boolean enable) |
long |
size()
A hint to return the size of the store on disk
|
void |
start() |
void |
stop() |
ByteSequence |
toByteSequence(org.apache.activeio.packet.Packet packet) |
org.apache.activeio.packet.Packet |
toPacket(ByteSequence sequence) |
java.lang.String |
toString() |
org.apache.activeio.journal.RecordLocation |
writeCommand(DataStructure command,
boolean sync) |
protected Scheduler scheduler
public JournalPersistenceAdapter()
public JournalPersistenceAdapter(org.apache.activeio.journal.Journal journal,
PersistenceAdapter longTermPersistence,
TaskRunnerFactory taskRunnerFactory)
throws java.io.IOException
java.io.IOExceptionpublic void setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory)
public void setJournal(org.apache.activeio.journal.Journal journal)
public void setPersistenceAdapter(PersistenceAdapter longTermPersistence)
public void setUsageManager(SystemUsage usageManager)
setUsageManager in interface PersistenceAdapterusageManager - The UsageManager that is controlling the
destination's memory usage.public java.util.Set<ActiveMQDestination> getDestinations()
PersistenceAdapterActiveMQDestination
objects that the persistence store is aware exist.getDestinations in interface PersistenceAdapterpublic MessageStore createQueueMessageStore(ActiveMQQueue destination) throws java.io.IOException
PersistenceAdaptercreateQueueMessageStore in interface PersistenceAdapterjava.io.IOExceptionpublic TopicMessageStore createTopicMessageStore(ActiveMQTopic destinationName) throws java.io.IOException
PersistenceAdaptercreateTopicMessageStore in interface PersistenceAdapterjava.io.IOExceptionpublic void removeQueueMessageStore(ActiveMQQueue destination)
removeQueueMessageStore in interface PersistenceAdapterdestination - Destination to forgetpublic void removeTopicMessageStore(ActiveMQTopic destination)
removeTopicMessageStore in interface PersistenceAdapterdestination - Destination to forgetpublic TransactionStore createTransactionStore() throws java.io.IOException
PersistenceAdaptercreateTransactionStore in interface PersistenceAdapterjava.io.IOExceptionpublic long getLastMessageBrokerSequenceId()
throws java.io.IOException
getLastMessageBrokerSequenceId in interface PersistenceAdapterjava.io.IOExceptionpublic void beginTransaction(ConnectionContext context) throws java.io.IOException
PersistenceAdapterbeginTransaction in interface PersistenceAdapterjava.io.IOExceptionpublic void commitTransaction(ConnectionContext context) throws java.io.IOException
PersistenceAdaptercommitTransaction in interface PersistenceAdapterjava.io.IOExceptionPersistenceAdapter.beginTransaction(ConnectionContext context)public void rollbackTransaction(ConnectionContext context) throws java.io.IOException
PersistenceAdapterrollbackTransaction in interface PersistenceAdapterjava.io.IOExceptionPersistenceAdapter.beginTransaction(ConnectionContext context)public void start()
throws java.lang.Exception
public void stop()
throws java.lang.Exception
public PersistenceAdapter getLongTermPersistence()
public WireFormat getWireFormat()
public void overflowNotification(org.apache.activeio.journal.RecordLocation safeLocation)
overflowNotification in interface org.apache.activeio.journal.JournalEventListenerorg.apache.activemq.journal.JournalEventListener#overflowNotification(org.apache.activemq.journal.RecordLocation)public void checkpoint(boolean sync,
boolean fullCheckpoint)
public void checkpoint(boolean sync)
PersistenceAdaptercheckpoint in interface PersistenceAdapterpublic boolean doCheckpoint()
public DataStructure readCommand(org.apache.activeio.journal.RecordLocation location) throws java.io.IOException
location - java.io.IOExceptionprotected java.io.IOException createWriteException(DataStructure packet, java.lang.Exception e)
protected java.io.IOException createWriteException(java.lang.String command,
java.lang.Exception e)
protected java.io.IOException createRecoveryFailedException(java.lang.Exception e)
public org.apache.activeio.journal.RecordLocation writeCommand(DataStructure command, boolean sync) throws java.io.IOException
command - sync - java.io.IOExceptionpublic void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage)
onUsageChanged in interface UsageListenerpublic JournalTransactionStore getTransactionStore()
public void deleteAllMessages()
throws java.io.IOException
PersistenceAdapterdeleteAllMessages in interface PersistenceAdapterjava.io.IOExceptionpublic SystemUsage getUsageManager()
public int getMaxCheckpointMessageAddSize()
public void setMaxCheckpointMessageAddSize(int maxCheckpointMessageAddSize)
public int getMaxCheckpointWorkers()
public void setMaxCheckpointWorkers(int maxCheckpointWorkers)
public boolean isUseExternalMessageReferences()
public void setUseExternalMessageReferences(boolean enable)
public org.apache.activeio.packet.Packet toPacket(ByteSequence sequence)
public ByteSequence toByteSequence(org.apache.activeio.packet.Packet packet)
public void setBrokerName(java.lang.String brokerName)
PersistenceAdaptersetBrokerName in interface PersistenceAdapterpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setDirectory(java.io.File dir)
PersistenceAdaptersetDirectory in interface PersistenceAdapterpublic java.io.File getDirectory()
getDirectory in interface PersistenceAdapterpublic long size()
PersistenceAdaptersize in interface PersistenceAdapterpublic void setBrokerService(BrokerService brokerService)
setBrokerService in interface BrokerServiceAwarepublic long getLastProducerSequenceId(ProducerId id)
PersistenceAdaptergetLastProducerSequenceId in interface PersistenceAdapterid - the producerId to find a sequenceId forCopyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.