org.apache.activemq.store.kahadb
Class MessageDatabase
java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.store.kahadb.MessageDatabase
- All Implemented Interfaces:
- BrokerServiceAware, org.apache.activemq.Service
- Direct Known Subclasses:
- KahaDBStore
public abstract class MessageDatabase
- extends ServiceSupport
- implements BrokerServiceAware
|
Method Summary |
protected void |
checkpointCleanup(boolean cleanup)
|
void |
close()
|
void |
doStart()
|
void |
doStop(ServiceStopper stopper)
|
void |
forgetRecoveredAcks(ArrayList<org.apache.activemq.command.MessageAck> acks)
|
long |
getCheckpointInterval()
|
long |
getCleanupInterval()
|
File |
getDirectory()
|
File |
getDirectoryArchive()
|
protected org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination |
getExistingStoredDestination(KahaDestination destination,
Transaction tx)
|
int |
getFailoverProducersAuditDepth()
|
int |
getIndexCacheSize()
|
float |
getIndexLFUEvictionFactor()
|
int |
getIndexWriteBatchSize()
|
Location[] |
getInProgressTxLocationRange()
|
Journal |
getJournal()
|
HashSet<Integer> |
getJournalFilesBeingReplicated()
|
int |
getJournalMaxFileLength()
|
int |
getJournalMaxWriteBatchSize()
|
org.apache.activemq.store.kahadb.MessageDatabase.LastAck |
getLastAck(Transaction tx,
org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination sd,
String subscriptionKey)
|
Location |
getLastUpdatePosition()
|
int |
getMaxFailoverProducersToTrack()
|
PageFile |
getPageFile()
|
protected org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination |
getStoredDestination(KahaDestination destination,
Transaction tx)
|
long |
getStoredMessageCount(Transaction tx,
org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination sd,
String subscriptionKey)
|
String |
getTransactions()
|
void |
incrementalRecover()
|
boolean |
isArchiveCorruptedIndex()
|
boolean |
isArchiveDataLogs()
|
boolean |
isCheckForCorruptJournalFiles()
|
boolean |
isChecksumJournalFiles()
|
boolean |
isDeleteAllMessages()
|
boolean |
isEnableIndexDiskSyncs()
|
boolean |
isEnableIndexPageCaching()
|
boolean |
isEnableIndexRecoveryFile()
|
boolean |
isEnableJournalDiskSyncs()
|
boolean |
isFailIfDatabaseIsLocked()
|
boolean |
isIgnoreMissingJournalfiles()
|
boolean |
isRewriteOnRedelivery()
|
boolean |
isUseIndexLFRUEviction()
|
void |
load()
|
JournalCommand<?> |
load(Location location)
Loads a previously stored JournalMessage |
void |
open()
|
protected void |
process(KahaAddMessageCommand command,
Location location)
|
protected void |
process(KahaCommitCommand command,
Location location,
Runnable before,
Runnable after)
|
protected void |
process(KahaPrepareCommand command,
Location location)
|
protected void |
process(KahaRemoveDestinationCommand command,
Location location)
|
protected void |
process(KahaRemoveMessageCommand command,
Location location)
|
protected void |
process(KahaRollbackCommand command,
Location location)
|
protected void |
process(KahaSubscriptionCommand command,
Location location)
|
protected void |
processLocation(Location location)
|
protected void |
recoverIndex(Transaction tx)
|
void |
setArchiveCorruptedIndex(boolean archiveCorruptedIndex)
|
void |
setArchiveDataLogs(boolean archiveDataLogs)
|
void |
setBrokerService(BrokerService brokerService)
|
void |
setCheckForCorruptJournalFiles(boolean checkForCorruptJournalFiles)
|
void |
setCheckpointInterval(long checkpointInterval)
|
void |
setChecksumJournalFiles(boolean checksumJournalFiles)
|
void |
setCleanupInterval(long cleanupInterval)
|
void |
setDeleteAllMessages(boolean deleteAllMessages)
|
void |
setDirectory(File directory)
|
void |
setDirectoryArchive(File directoryArchive)
|
void |
setEnableIndexDiskSyncs(boolean enableIndexDiskSyncs)
|
void |
setEnableIndexPageCaching(boolean enableIndexPageCaching)
|
void |
setEnableIndexRecoveryFile(boolean enableIndexRecoveryFile)
|
void |
setEnableIndexWriteAsync(boolean enableIndexWriteAsync)
|
void |
setEnableJournalDiskSyncs(boolean syncWrites)
|
void |
setFailIfDatabaseIsLocked(boolean failIfDatabaseIsLocked)
|
void |
setFailoverProducersAuditDepth(int failoverProducersAuditDepth)
|
void |
setIgnoreMissingJournalfiles(boolean ignoreMissingJournalfiles)
|
void |
setIndexCacheSize(int indexCacheSize)
|
void |
setIndexLFUEvictionFactor(float indexLFUEvictionFactor)
|
void |
setIndexWriteBatchSize(int setIndexWriteBatchSize)
|
void |
setJournalMaxFileLength(int journalMaxFileLength)
|
void |
setJournalMaxWriteBatchSize(int journalMaxWriteBatchSize)
|
void |
setMaxFailoverProducersToTrack(int maxFailoverProducersToTrack)
|
void |
setRewriteOnRedelivery(boolean rewriteOnRedelivery)
|
void |
setUseIndexLFRUEviction(boolean useIndexLFRUEviction)
|
Location |
store(JournalCommand<?> data)
|
Location |
store(JournalCommand<?> data,
boolean sync,
Runnable before,
Runnable after)
|
Location |
store(JournalCommand<?> data,
boolean sync,
Runnable before,
Runnable after,
Runnable onJournalStoreComplete)
All updated are are funneled through this method. |
Location |
store(JournalCommand<?> data,
Runnable onJournalStoreComplete)
|
ByteSequence |
toByteSequence(JournalCommand<?> data)
|
void |
trackRecoveredAcks(ArrayList<org.apache.activemq.command.MessageAck> acks)
|
void |
unload()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
brokerService
protected BrokerService brokerService
PROPERTY_LOG_SLOW_ACCESS_TIME
public static final String PROPERTY_LOG_SLOW_ACCESS_TIME
- See Also:
- Constant Field Values
LOG_SLOW_ACCESS_TIME
public static final int LOG_SLOW_ACCESS_TIME
DEFAULT_DIRECTORY
public static final File DEFAULT_DIRECTORY
UNMATCHED
protected static final org.apache.activemq.protobuf.Buffer UNMATCHED
pageFile
protected PageFile pageFile
journal
protected Journal journal
metadata
protected MessageDatabase.Metadata metadata
metadataMarshaller
protected org.apache.activemq.store.kahadb.MessageDatabase.MetadataMarshaller metadataMarshaller
failIfDatabaseIsLocked
protected boolean failIfDatabaseIsLocked
deleteAllMessages
protected boolean deleteAllMessages
directory
protected File directory
checkpointThread
protected Thread checkpointThread
enableJournalDiskSyncs
protected boolean enableJournalDiskSyncs
archiveDataLogs
protected boolean archiveDataLogs
directoryArchive
protected File directoryArchive
journalSize
protected AtomicLong journalSize
opened
protected AtomicBoolean opened
forceRecoverIndex
protected boolean forceRecoverIndex
indexLock
protected final ReentrantReadWriteLock indexLock
preparedTransactions
protected final LinkedHashMap<org.apache.activemq.command.TransactionId,List<org.apache.activemq.store.kahadb.MessageDatabase.Operation>> preparedTransactions
ackedAndPrepared
protected final Set<String> ackedAndPrepared
MessageDatabase
public MessageDatabase()
doStart
public void doStart()
throws Exception
- Specified by:
doStart in class ServiceSupport
- Throws:
Exception
doStop
public void doStop(ServiceStopper stopper)
throws Exception
- Specified by:
doStop in class ServiceSupport
- Throws:
Exception
open
public void open()
throws IOException
- Throws:
IOException
load
public void load()
throws IOException
- Throws:
IOException
close
public void close()
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
unload
public void unload()
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
getInProgressTxLocationRange
public Location[] getInProgressTxLocationRange()
getTransactions
public String getTransactions()
recoverIndex
protected void recoverIndex(Transaction tx)
throws IOException
- Throws:
IOException
incrementalRecover
public void incrementalRecover()
throws IOException
- Throws:
IOException
getLastUpdatePosition
public Location getLastUpdatePosition()
throws IOException
- Throws:
IOException
checkpointCleanup
protected void checkpointCleanup(boolean cleanup)
throws IOException
- Throws:
IOException
toByteSequence
public ByteSequence toByteSequence(JournalCommand<?> data)
throws IOException
- Throws:
IOException
store
public Location store(JournalCommand<?> data)
throws IOException
- Throws:
IOException
store
public Location store(JournalCommand<?> data,
Runnable onJournalStoreComplete)
throws IOException
- Throws:
IOException
store
public Location store(JournalCommand<?> data,
boolean sync,
Runnable before,
Runnable after)
throws IOException
- Throws:
IOException
store
public Location store(JournalCommand<?> data,
boolean sync,
Runnable before,
Runnable after,
Runnable onJournalStoreComplete)
throws IOException
- All updated are are funneled through this method. The updates are converted
to a JournalMessage which is logged to the journal and then the data from
the JournalMessage is used to update the index just like it would be done
during a recovery process.
- Throws:
IOException
load
public JournalCommand<?> load(Location location)
throws IOException
- Loads a previously stored JournalMessage
- Parameters:
location -
- Returns:
-
- Throws:
IOException
process
protected void process(KahaAddMessageCommand command,
Location location)
throws IOException
- Throws:
IOException
process
protected void process(KahaRemoveMessageCommand command,
Location location)
throws IOException
- Throws:
IOException
process
protected void process(KahaRemoveDestinationCommand command,
Location location)
throws IOException
- Throws:
IOException
process
protected void process(KahaSubscriptionCommand command,
Location location)
throws IOException
- Throws:
IOException
processLocation
protected void processLocation(Location location)
process
protected void process(KahaCommitCommand command,
Location location,
Runnable before,
Runnable after)
throws IOException
- Throws:
IOException
process
protected void process(KahaPrepareCommand command,
Location location)
process
protected void process(KahaRollbackCommand command,
Location location)
throws IOException
- Throws:
IOException
getJournalFilesBeingReplicated
public HashSet<Integer> getJournalFilesBeingReplicated()
getStoredDestination
protected org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination getStoredDestination(KahaDestination destination,
Transaction tx)
throws IOException
- Throws:
IOException
getExistingStoredDestination
protected org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination getExistingStoredDestination(KahaDestination destination,
Transaction tx)
throws IOException
- Throws:
IOException
getLastAck
public org.apache.activemq.store.kahadb.MessageDatabase.LastAck getLastAck(Transaction tx,
org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination sd,
String subscriptionKey)
throws IOException
- Throws:
IOException
getStoredMessageCount
public long getStoredMessageCount(Transaction tx,
org.apache.activemq.store.kahadb.MessageDatabase.StoredDestination sd,
String subscriptionKey)
throws IOException
- Throws:
IOException
trackRecoveredAcks
public void trackRecoveredAcks(ArrayList<org.apache.activemq.command.MessageAck> acks)
forgetRecoveredAcks
public void forgetRecoveredAcks(ArrayList<org.apache.activemq.command.MessageAck> acks)
throws IOException
- Throws:
IOException
getJournalMaxWriteBatchSize
public int getJournalMaxWriteBatchSize()
setJournalMaxWriteBatchSize
public void setJournalMaxWriteBatchSize(int journalMaxWriteBatchSize)
getDirectory
public File getDirectory()
setDirectory
public void setDirectory(File directory)
isDeleteAllMessages
public boolean isDeleteAllMessages()
setDeleteAllMessages
public void setDeleteAllMessages(boolean deleteAllMessages)
setIndexWriteBatchSize
public void setIndexWriteBatchSize(int setIndexWriteBatchSize)
getIndexWriteBatchSize
public int getIndexWriteBatchSize()
setEnableIndexWriteAsync
public void setEnableIndexWriteAsync(boolean enableIndexWriteAsync)
isEnableJournalDiskSyncs
public boolean isEnableJournalDiskSyncs()
setEnableJournalDiskSyncs
public void setEnableJournalDiskSyncs(boolean syncWrites)
getCheckpointInterval
public long getCheckpointInterval()
setCheckpointInterval
public void setCheckpointInterval(long checkpointInterval)
getCleanupInterval
public long getCleanupInterval()
setCleanupInterval
public void setCleanupInterval(long cleanupInterval)
setJournalMaxFileLength
public void setJournalMaxFileLength(int journalMaxFileLength)
getJournalMaxFileLength
public int getJournalMaxFileLength()
setMaxFailoverProducersToTrack
public void setMaxFailoverProducersToTrack(int maxFailoverProducersToTrack)
getMaxFailoverProducersToTrack
public int getMaxFailoverProducersToTrack()
setFailoverProducersAuditDepth
public void setFailoverProducersAuditDepth(int failoverProducersAuditDepth)
getFailoverProducersAuditDepth
public int getFailoverProducersAuditDepth()
getPageFile
public PageFile getPageFile()
getJournal
public Journal getJournal()
throws IOException
- Throws:
IOException
isFailIfDatabaseIsLocked
public boolean isFailIfDatabaseIsLocked()
setFailIfDatabaseIsLocked
public void setFailIfDatabaseIsLocked(boolean failIfDatabaseIsLocked)
isIgnoreMissingJournalfiles
public boolean isIgnoreMissingJournalfiles()
setIgnoreMissingJournalfiles
public void setIgnoreMissingJournalfiles(boolean ignoreMissingJournalfiles)
getIndexCacheSize
public int getIndexCacheSize()
setIndexCacheSize
public void setIndexCacheSize(int indexCacheSize)
isCheckForCorruptJournalFiles
public boolean isCheckForCorruptJournalFiles()
setCheckForCorruptJournalFiles
public void setCheckForCorruptJournalFiles(boolean checkForCorruptJournalFiles)
isChecksumJournalFiles
public boolean isChecksumJournalFiles()
setChecksumJournalFiles
public void setChecksumJournalFiles(boolean checksumJournalFiles)
setBrokerService
public void setBrokerService(BrokerService brokerService)
- Specified by:
setBrokerService in interface BrokerServiceAware
isArchiveDataLogs
public boolean isArchiveDataLogs()
- Returns:
- the archiveDataLogs
setArchiveDataLogs
public void setArchiveDataLogs(boolean archiveDataLogs)
- Parameters:
archiveDataLogs - the archiveDataLogs to set
getDirectoryArchive
public File getDirectoryArchive()
- Returns:
- the directoryArchive
setDirectoryArchive
public void setDirectoryArchive(File directoryArchive)
- Parameters:
directoryArchive - the directoryArchive to set
isRewriteOnRedelivery
public boolean isRewriteOnRedelivery()
setRewriteOnRedelivery
public void setRewriteOnRedelivery(boolean rewriteOnRedelivery)
isArchiveCorruptedIndex
public boolean isArchiveCorruptedIndex()
setArchiveCorruptedIndex
public void setArchiveCorruptedIndex(boolean archiveCorruptedIndex)
getIndexLFUEvictionFactor
public float getIndexLFUEvictionFactor()
setIndexLFUEvictionFactor
public void setIndexLFUEvictionFactor(float indexLFUEvictionFactor)
isUseIndexLFRUEviction
public boolean isUseIndexLFRUEviction()
setUseIndexLFRUEviction
public void setUseIndexLFRUEviction(boolean useIndexLFRUEviction)
setEnableIndexDiskSyncs
public void setEnableIndexDiskSyncs(boolean enableIndexDiskSyncs)
setEnableIndexRecoveryFile
public void setEnableIndexRecoveryFile(boolean enableIndexRecoveryFile)
setEnableIndexPageCaching
public void setEnableIndexPageCaching(boolean enableIndexPageCaching)
isEnableIndexDiskSyncs
public boolean isEnableIndexDiskSyncs()
isEnableIndexRecoveryFile
public boolean isEnableIndexRecoveryFile()
isEnableIndexPageCaching
public boolean isEnableIndexPageCaching()
Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.