public class JournalPersistenceAdapter extends 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.Modifier and Type | Field and Description |
---|---|
protected org.apache.activemq.thread.Scheduler |
scheduler |
Constructor and Description |
---|
JournalPersistenceAdapter() |
JournalPersistenceAdapter(org.apache.activeio.journal.Journal journal,
PersistenceAdapter longTermPersistence,
org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory) |
Modifier and Type | Method and Description |
---|---|
void |
allowIOResumption() |
void |
beginTransaction(ConnectionContext context) |
void |
checkpoint(boolean sync) |
void |
checkpoint(boolean sync,
boolean fullCheckpoint)
When we checkpoint we move all the journalled data to long term storage.
|
void |
commitTransaction(ConnectionContext context) |
JobSchedulerStore |
createJobSchedulerStore() |
MessageStore |
createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) |
protected IOException |
createRecoveryFailedException(Exception e) |
TopicMessageStore |
createTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destinationName) |
TransactionStore |
createTransactionStore() |
protected IOException |
createWriteException(org.apache.activemq.command.DataStructure packet,
Exception e) |
protected IOException |
createWriteException(String command,
Exception e) |
void |
deleteAllMessages() |
boolean |
doCheckpoint()
This does the actual checkpoint.
|
long |
getCheckpointInterval() |
Set<org.apache.activemq.command.ActiveMQDestination> |
getDestinations() |
File |
getDirectory() |
long |
getLastMessageBrokerSequenceId() |
long |
getLastProducerSequenceId(org.apache.activemq.command.ProducerId id) |
PersistenceAdapter |
getLongTermPersistence() |
int |
getMaxCheckpointMessageAddSize() |
int |
getMaxCheckpointWorkers() |
JournalTransactionStore |
getTransactionStore() |
SystemUsage |
getUsageManager() |
org.apache.activemq.wireformat.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.
|
org.apache.activemq.command.DataStructure |
readCommand(org.apache.activeio.journal.RecordLocation location) |
void |
removeQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination)
Cleanup method to remove any state associated with the given destination
|
void |
removeTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination)
Cleanup method to remove any state associated with the given destination
|
void |
rollbackTransaction(ConnectionContext context) |
void |
setBrokerName(String brokerName) |
void |
setBrokerService(BrokerService brokerService) |
void |
setCheckpointInterval(long checkpointInterval) |
void |
setDirectory(File dir) |
void |
setJournal(org.apache.activeio.journal.Journal journal) |
void |
setMaxCheckpointMessageAddSize(int maxCheckpointMessageAddSize) |
void |
setMaxCheckpointWorkers(int maxCheckpointWorkers) |
void |
setPersistenceAdapter(PersistenceAdapter longTermPersistence) |
void |
setTaskRunnerFactory(org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory) |
void |
setUsageManager(SystemUsage usageManager) |
void |
setUseExternalMessageReferences(boolean enable) |
long |
size() |
void |
start() |
void |
stop() |
ByteSequence |
toByteSequence(org.apache.activeio.packet.Packet packet) |
org.apache.activeio.packet.Packet |
toPacket(ByteSequence sequence) |
String |
toString() |
org.apache.activeio.journal.RecordLocation |
writeCommand(org.apache.activemq.command.DataStructure command,
boolean sync) |
protected org.apache.activemq.thread.Scheduler scheduler
public JournalPersistenceAdapter()
public JournalPersistenceAdapter(org.apache.activeio.journal.Journal journal, PersistenceAdapter longTermPersistence, org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory) throws IOException
IOException
public void setTaskRunnerFactory(org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory)
public void setJournal(org.apache.activeio.journal.Journal journal)
public void setPersistenceAdapter(PersistenceAdapter longTermPersistence)
public void setUsageManager(SystemUsage usageManager)
setUsageManager
in interface PersistenceAdapter
usageManager
- The UsageManager that is controlling the
destination's memory usage.public Set<org.apache.activemq.command.ActiveMQDestination> getDestinations()
getDestinations
in interface PersistenceAdapter
public MessageStore createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination) throws IOException
createQueueMessageStore
in interface PersistenceAdapter
IOException
public TopicMessageStore createTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destinationName) throws IOException
createTopicMessageStore
in interface PersistenceAdapter
IOException
public void removeQueueMessageStore(org.apache.activemq.command.ActiveMQQueue destination)
removeQueueMessageStore
in interface PersistenceAdapter
destination
- Destination to forgetpublic void removeTopicMessageStore(org.apache.activemq.command.ActiveMQTopic destination)
removeTopicMessageStore
in interface PersistenceAdapter
destination
- Destination to forgetpublic TransactionStore createTransactionStore() throws IOException
createTransactionStore
in interface PersistenceAdapter
IOException
public long getLastMessageBrokerSequenceId() throws IOException
getLastMessageBrokerSequenceId
in interface PersistenceAdapter
IOException
public void beginTransaction(ConnectionContext context) throws IOException
beginTransaction
in interface PersistenceAdapter
IOException
public void commitTransaction(ConnectionContext context) throws IOException
commitTransaction
in interface PersistenceAdapter
IOException
public void rollbackTransaction(ConnectionContext context) throws IOException
rollbackTransaction
in interface PersistenceAdapter
IOException
public void start() throws Exception
start
in interface org.apache.activemq.Service
Exception
public void stop() throws Exception
stop
in interface org.apache.activemq.Service
Exception
public PersistenceAdapter getLongTermPersistence()
public org.apache.activemq.wireformat.WireFormat getWireFormat()
public void overflowNotification(org.apache.activeio.journal.RecordLocation safeLocation)
overflowNotification
in interface org.apache.activeio.journal.JournalEventListener
org.apache.activemq.journal.JournalEventListener#overflowNotification(org.apache.activemq.journal.RecordLocation)
public void checkpoint(boolean sync, boolean fullCheckpoint)
public void checkpoint(boolean sync)
checkpoint
in interface PersistenceAdapter
public boolean doCheckpoint()
public org.apache.activemq.command.DataStructure readCommand(org.apache.activeio.journal.RecordLocation location) throws IOException
location
- IOException
protected IOException createWriteException(org.apache.activemq.command.DataStructure packet, Exception e)
protected IOException createWriteException(String command, Exception e)
protected IOException createRecoveryFailedException(Exception e)
public org.apache.activeio.journal.RecordLocation writeCommand(org.apache.activemq.command.DataStructure command, boolean sync) throws IOException
command
- sync
- IOException
public void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage)
onUsageChanged
in interface UsageListener
public JournalTransactionStore getTransactionStore()
public void deleteAllMessages() throws IOException
deleteAllMessages
in interface PersistenceAdapter
IOException
public SystemUsage getUsageManager()
public int getMaxCheckpointMessageAddSize()
public void setMaxCheckpointMessageAddSize(int maxCheckpointMessageAddSize)
public int getMaxCheckpointWorkers()
public void setMaxCheckpointWorkers(int maxCheckpointWorkers)
public long getCheckpointInterval()
public void setCheckpointInterval(long checkpointInterval)
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(String brokerName)
setBrokerName
in interface PersistenceAdapter
public void setDirectory(File dir)
setDirectory
in interface PersistenceAdapter
public File getDirectory()
getDirectory
in interface PersistenceAdapter
public long size()
size
in interface PersistenceAdapter
public void setBrokerService(BrokerService brokerService)
setBrokerService
in interface BrokerServiceAware
public long getLastProducerSequenceId(org.apache.activemq.command.ProducerId id)
getLastProducerSequenceId
in interface PersistenceAdapter
public void allowIOResumption()
allowIOResumption
in interface PersistenceAdapter
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException
createJobSchedulerStore
in interface PersistenceAdapter
IOException
UnsupportedOperationException
Copyright © 2005–2020 FuseSource, Corp.. All rights reserved.