Interface StorageManager
-
- All Superinterfaces:
ActiveMQComponent,IDGenerator
- All Known Implementing Classes:
AbstractJournalStorageManager,JDBCJournalStorageManager,JournalStorageManager,NullStorageManager
public interface StorageManager extends IDGenerator, ActiveMQComponent
A StorageManager Note about IDGEnerator I've changed StorageManager to extend IDGenerator, because in some places all we needed from the StorageManager was the idGeneration. I couldn't just get the IDGenerator from the inner part because the NullPersistent has its own sequence. So the best was to add the interface and adjust the callers for the method
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classStorageManager.LargeMessageExtension
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddAddressBinding(long tx, AddressInfo addressInfo)voidaddBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes)voidaddBytesToLargeMessage(SequentialFile file, long messageId, ActiveMQBuffer bytes)voidaddGrouping(GroupBinding groupBinding)voidaddQueueBinding(long tx, Binding binding)booleanaddToPage(PagingStore store, Message msg, Transaction tx, RouteContextList listCtx)Write message to page if we are paging.voidafterCompleteOperations(IOCallback run)voidafterStoreOperations(IOCallback run)This is similar to afterComplete, however this only cares about the journal part.ByteBufferallocateDirectBuffer(int size)AIO has an optimized buffer which has a method to release it instead of the way NIO will release data based on GC.voidclearContext()ArtemisCloseablecloseableReadLock()Read lock the StorageManager.voidcommit(long txID)voidcommit(long txID, boolean lineUpContext)voidcommitBindings(long txID)voidconfirmPendingLargeMessage(long recordID)Confirms that a large message was finishedvoidconfirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID)Confirms that a large message was finisheddefault SequentialFilecreateFileForLargeMessage(long messageID, boolean durable)SequentialFilecreateFileForLargeMessage(long messageID, StorageManager.LargeMessageExtension extension)Instantiates a SequentialFile to be used for storing aLargeServerMessage.LargeServerMessagecreateLargeMessage()LargeServerMessagecreateLargeMessage(long id, Message message)Creates a new LargeMessage with the given id.voidcriticalError(Throwable error)voiddeleteAddressBinding(long tx, long addressBindingID)voiddeleteAddressSetting(SimpleString addressMatch)voiddeleteAddressStatus(long recordID)voiddeleteCursorAcknowledge(long ackID)voiddeleteCursorAcknowledgeTransactional(long txID, long ackID)voiddeleteDivertConfiguration(String divertName)voiddeleteDuplicateID(long recordID)voiddeleteDuplicateIDTransactional(long txID, long recordID)voiddeleteGrouping(long tx, GroupBinding groupBinding)voiddeleteHeuristicCompletion(long id)voiddeleteID(long journalD)voiddeleteIncrementRecord(long txID, long recordID)voiddeleteKeyValuePair(String mapId, String key)voiddeleteLargeMessageBody(LargeServerMessage largeServerMessage)voiddeleteMessage(long messageID)voiddeletePageComplete(long ackID)voiddeletePageCounter(long txID, long recordID)voiddeletePageTransactional(long recordID)voiddeletePendingPageCounter(long txID, long recordID)voiddeleteQueueBinding(long tx, long queueBindingID)voiddeleteQueueStatus(long recordID)voiddeleteRole(String role)voiddeleteSecuritySetting(SimpleString addressMatch)voiddeleteUser(String username)voidfreeDirectBuffer(ByteBuffer buffer)AIO has an optimized buffer which has a method to release it instead of the way NIO will release data based on GC.JournalgetBindingsJournal()OperationContextgetContext()Get the context associated with the thread for later reusedefault SequentialFileFactorygetJournalSequentialFileFactory()default longgetMaxRecordSize()JournalgetMessageJournal()Map<String,PersistedKeyValuePair>getPersistedKeyValuePairs(String mapId)Map<String,PersistedRole>getPersistedRoles()Map<String,PersistedUser>getPersistedUsers()voidinjectMonitor(FileStoreMonitor monitor)voidlargeMessageClosed(LargeServerMessage largeServerMessage)LargeServerMessagelargeMessageCreated(long id, LargeServerMessage largeMessage)voidlineUpContext()JournalLoadInformationloadBindingJournal(List<QueueBindingInfo> queueBindingInfos, List<GroupingInfo> groupingInfos, List<AddressBindingInfo> addressBindingInfos)JournalLoadInformationloadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long,QueueBindingInfo> queueInfos, Map<SimpleString,List<Pair<byte[],Long>>> duplicateIDMap, Set<Pair<Long,Long>> pendingLargeMessages, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader)OperationContextnewContext(Executor executor)It just creates an OperationContext without associating itOperationContextnewSingleThreadContext()voidpageClosed(SimpleString storeName, long pageNumber)voidpageDeleted(SimpleString storeName, long pageNumber)voidpageWrite(PagedMessage message, long pageNumber)voidpersistIdGenerator()Closes theIDGeneratorpersisting the current record ID.voidprepare(long txID, Xid xid)List<PersistedAddressSetting>recoverAddressSettings()List<PersistedDivertConfiguration>recoverDivertConfigurations()List<PersistedSecuritySetting>recoverSecuritySettings()voidrollback(long txID)voidrollbackBindings(long txID)voidsetContext(OperationContext context)Set the context back to the threadvoidstartReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID, boolean autoFailBack, long initialReplicationSyncTimeout)voidstop(boolean ioCriticalError, boolean sendFailover)voidstopReplication()Stops the replication of data from the live to the backup.voidstoreAcknowledge(long queueID, long messageID)voidstoreAcknowledgeTransactional(long txID, long queueID, long messageID)voidstoreAddressSetting(PersistedAddressSetting addressSetting)longstoreAddressStatus(long addressID, AddressQueueStatus status)voidstoreCursorAcknowledge(long queueID, PagePosition position)voidstoreCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position)voidstoreDivertConfiguration(PersistedDivertConfiguration persistedDivertConfiguration)voidstoreDuplicateID(SimpleString address, byte[] duplID, long recordID)voidstoreDuplicateIDTransactional(long txID, SimpleString address, byte[] duplID, long recordID)longstoreHeuristicCompletion(Xid xid, boolean isCommit)voidstoreID(long journalID, long id)Stores the id from IDManager.voidstoreKeyValuePair(PersistedKeyValuePair persistedKeyValuePair)voidstoreMessage(Message message)voidstoreMessageTransactional(long txID, Message message)voidstorePageCompleteTransactional(long txID, long queueID, PagePosition position)longstorePageCounter(long txID, long queueID, long value, long persistentSize)longstorePageCounterInc(long queueID, int add, long size)longstorePageCounterInc(long txID, long queueID, int add, long persistentSize)voidstorePageTransaction(long txID, PageTransactionInfo pageTransaction)longstorePendingCounter(long queueID, long pageID)longstoreQueueStatus(long queueID, AddressQueueStatus status)voidstoreReference(long queueID, long messageID, boolean last)voidstoreReferenceTransactional(long txID, long queueID, long messageID)voidstoreRole(PersistedRole persistedRole)voidstoreSecuritySetting(PersistedSecuritySetting persistedRoles)voidstoreUser(PersistedUser persistedUser)voidupdateDeliveryCount(MessageReference ref)voidupdateDuplicateIDTransactional(long txID, SimpleString address, byte[] duplID, long recordID)voidupdatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage)voidupdateQueueBinding(long tx, Binding binding)voidupdateScheduledDeliveryTime(MessageReference ref)voidupdateScheduledDeliveryTimeTransactional(long txID, MessageReference ref)voidwaitOnOperations()Block until the operations are done.booleanwaitOnOperations(long timeout)Block until the operations are done.-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop, isStarted, start, stop
-
Methods inherited from interface org.apache.activemq.artemis.utils.IDGenerator
generateID, getCurrentID
-
-
-
-
Method Detail
-
getMaxRecordSize
default long getMaxRecordSize()
-
getJournalSequentialFileFactory
default SequentialFileFactory getJournalSequentialFileFactory()
-
criticalError
void criticalError(Throwable error)
-
getContext
OperationContext getContext()
Get the context associated with the thread for later reuse
-
lineUpContext
void lineUpContext()
-
newContext
OperationContext newContext(Executor executor)
It just creates an OperationContext without associating it
-
newSingleThreadContext
OperationContext newSingleThreadContext()
-
setContext
void setContext(OperationContext context)
Set the context back to the thread
-
stop
void stop(boolean ioCriticalError, boolean sendFailover) throws Exception- Parameters:
ioCriticalError- is the server being stopped due to an IO critical error.sendFailover- this is to send the replication stopping in case of replication.- Throws:
Exception
-
pageClosed
void pageClosed(SimpleString storeName, long pageNumber)
-
pageDeleted
void pageDeleted(SimpleString storeName, long pageNumber)
-
pageWrite
void pageWrite(PagedMessage message, long pageNumber)
-
afterCompleteOperations
void afterCompleteOperations(IOCallback run)
-
afterStoreOperations
void afterStoreOperations(IOCallback run)
This is similar to afterComplete, however this only cares about the journal part.
-
waitOnOperations
boolean waitOnOperations(long timeout) throws ExceptionBlock until the operations are done. Warning: Don't use it inside an ordered executor, otherwise the system may lock up in case of the pools are full- Throws:
Exception
-
waitOnOperations
void waitOnOperations() throws ExceptionBlock until the operations are done. Warning: Don't use it inside an ordered executor, otherwise the system may lock up in case of the pools are full- Throws:
Exception
-
allocateDirectBuffer
ByteBuffer allocateDirectBuffer(int size)
AIO has an optimized buffer which has a method to release it instead of the way NIO will release data based on GC. These methods will use that buffer if the inner method supports it
-
freeDirectBuffer
void freeDirectBuffer(ByteBuffer buffer)
AIO has an optimized buffer which has a method to release it instead of the way NIO will release data based on GC. These methods will use that buffer if the inner method supports it
-
clearContext
void clearContext()
-
confirmPendingLargeMessageTX
void confirmPendingLargeMessageTX(Transaction transaction, long messageID, long recordID) throws Exception
Confirms that a large message was finished- Throws:
Exception
-
confirmPendingLargeMessage
void confirmPendingLargeMessage(long recordID) throws ExceptionConfirms that a large message was finished- Throws:
Exception
-
storeReference
void storeReference(long queueID, long messageID, boolean last) throws Exception- Throws:
Exception
-
storeAcknowledge
void storeAcknowledge(long queueID, long messageID) throws Exception- Throws:
Exception
-
storeCursorAcknowledge
void storeCursorAcknowledge(long queueID, PagePosition position) throws Exception- Throws:
Exception
-
updateDeliveryCount
void updateDeliveryCount(MessageReference ref) throws Exception
- Throws:
Exception
-
updateScheduledDeliveryTime
void updateScheduledDeliveryTime(MessageReference ref) throws Exception
- Throws:
Exception
-
storeDuplicateID
void storeDuplicateID(SimpleString address, byte[] duplID, long recordID) throws Exception
- Throws:
Exception
-
storeMessageTransactional
void storeMessageTransactional(long txID, Message message) throws Exception- Throws:
Exception
-
storeReferenceTransactional
void storeReferenceTransactional(long txID, long queueID, long messageID) throws Exception- Throws:
Exception
-
storeAcknowledgeTransactional
void storeAcknowledgeTransactional(long txID, long queueID, long messageID) throws Exception- Throws:
Exception
-
storeCursorAcknowledgeTransactional
void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position) throws Exception- Throws:
Exception
-
deleteCursorAcknowledgeTransactional
void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception- Throws:
Exception
-
deleteCursorAcknowledge
void deleteCursorAcknowledge(long ackID) throws Exception- Throws:
Exception
-
storePageCompleteTransactional
void storePageCompleteTransactional(long txID, long queueID, PagePosition position) throws Exception- Throws:
Exception
-
updateScheduledDeliveryTimeTransactional
void updateScheduledDeliveryTimeTransactional(long txID, MessageReference ref) throws Exception- Throws:
Exception
-
storeDuplicateIDTransactional
void storeDuplicateIDTransactional(long txID, SimpleString address, byte[] duplID, long recordID) throws Exception- Throws:
Exception
-
updateDuplicateIDTransactional
void updateDuplicateIDTransactional(long txID, SimpleString address, byte[] duplID, long recordID) throws Exception- Throws:
Exception
-
deleteDuplicateIDTransactional
void deleteDuplicateIDTransactional(long txID, long recordID) throws Exception- Throws:
Exception
-
createLargeMessage
LargeServerMessage createLargeMessage()
-
createLargeMessage
LargeServerMessage createLargeMessage(long id, Message message) throws Exception
Creates a new LargeMessage with the given id.- Parameters:
id-message- This is a temporary message that holds the parsed properties. The remoting layer can't create a ServerMessage directly, then this will be replaced.- Returns:
- a large message object
- Throws:
Exception
-
largeMessageCreated
LargeServerMessage largeMessageCreated(long id, LargeServerMessage largeMessage) throws Exception
- Throws:
Exception
-
createFileForLargeMessage
SequentialFile createFileForLargeMessage(long messageID, StorageManager.LargeMessageExtension extension)
Instantiates a SequentialFile to be used for storing aLargeServerMessage.- Parameters:
messageID- the id of the messageextension- the extension to add to the file- Returns:
-
largeMessageClosed
void largeMessageClosed(LargeServerMessage largeServerMessage) throws ActiveMQException
- Throws:
ActiveMQException
-
deleteLargeMessageBody
void deleteLargeMessageBody(LargeServerMessage largeServerMessage) throws ActiveMQException
- Throws:
ActiveMQException
-
createFileForLargeMessage
default SequentialFile createFileForLargeMessage(long messageID, boolean durable)
-
storePageTransaction
void storePageTransaction(long txID, PageTransactionInfo pageTransaction) throws Exception- Throws:
Exception
-
updatePageTransaction
void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception- Throws:
Exception
-
deletePageTransactional
void deletePageTransactional(long recordID) throws Exception- Throws:
Exception
-
loadMessageJournal
JournalLoadInformation loadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long,QueueBindingInfo> queueInfos, Map<SimpleString,List<Pair<byte[],Long>>> duplicateIDMap, Set<Pair<Long,Long>> pendingLargeMessages, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader) throws Exception
- Throws:
Exception
-
storeHeuristicCompletion
long storeHeuristicCompletion(Xid xid, boolean isCommit) throws Exception
- Throws:
Exception
-
deleteHeuristicCompletion
void deleteHeuristicCompletion(long id) throws Exception- Throws:
Exception
-
updateQueueBinding
void updateQueueBinding(long tx, Binding binding) throws Exception- Throws:
Exception
-
deleteQueueBinding
void deleteQueueBinding(long tx, long queueBindingID) throws Exception- Throws:
Exception
-
storeQueueStatus
long storeQueueStatus(long queueID, AddressQueueStatus status) throws Exception- Parameters:
queueID- The id of the queuestatus- The current status of the queue. (Reserved for future use, ATM we only use this record for PAUSED)- Returns:
- the id of the journal
- Throws:
Exception
-
storeAddressStatus
long storeAddressStatus(long addressID, AddressQueueStatus status) throws Exception- Throws:
Exception
-
addAddressBinding
void addAddressBinding(long tx, AddressInfo addressInfo) throws Exception- Throws:
Exception
-
deleteAddressBinding
void deleteAddressBinding(long tx, long addressBindingID) throws Exception- Throws:
Exception
-
loadBindingJournal
JournalLoadInformation loadBindingJournal(List<QueueBindingInfo> queueBindingInfos, List<GroupingInfo> groupingInfos, List<AddressBindingInfo> addressBindingInfos) throws Exception
- Throws:
Exception
-
addGrouping
void addGrouping(GroupBinding groupBinding) throws Exception
- Throws:
Exception
-
deleteGrouping
void deleteGrouping(long tx, GroupBinding groupBinding) throws Exception- Throws:
Exception
-
storeAddressSetting
void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
- Throws:
Exception
-
deleteAddressSetting
void deleteAddressSetting(SimpleString addressMatch) throws Exception
- Throws:
Exception
-
recoverAddressSettings
List<PersistedAddressSetting> recoverAddressSettings() throws Exception
- Throws:
Exception
-
storeSecuritySetting
void storeSecuritySetting(PersistedSecuritySetting persistedRoles) throws Exception
- Throws:
Exception
-
deleteSecuritySetting
void deleteSecuritySetting(SimpleString addressMatch) throws Exception
- Throws:
Exception
-
recoverSecuritySettings
List<PersistedSecuritySetting> recoverSecuritySettings() throws Exception
- Throws:
Exception
-
storeDivertConfiguration
void storeDivertConfiguration(PersistedDivertConfiguration persistedDivertConfiguration) throws Exception
- Throws:
Exception
-
deleteDivertConfiguration
void deleteDivertConfiguration(String divertName) throws Exception
- Throws:
Exception
-
recoverDivertConfigurations
List<PersistedDivertConfiguration> recoverDivertConfigurations()
-
storeUser
void storeUser(PersistedUser persistedUser) throws Exception
- Throws:
Exception
-
getPersistedUsers
Map<String,PersistedUser> getPersistedUsers()
-
storeRole
void storeRole(PersistedRole persistedRole) throws Exception
- Throws:
Exception
-
getPersistedRoles
Map<String,PersistedRole> getPersistedRoles()
-
storeKeyValuePair
void storeKeyValuePair(PersistedKeyValuePair persistedKeyValuePair) throws Exception
- Throws:
Exception
-
deleteKeyValuePair
void deleteKeyValuePair(String mapId, String key) throws Exception
- Throws:
Exception
-
getPersistedKeyValuePairs
Map<String,PersistedKeyValuePair> getPersistedKeyValuePairs(String mapId)
-
storePageCounter
long storePageCounter(long txID, long queueID, long value, long persistentSize) throws Exception- Returns:
- The ID with the stored counter
- Throws:
Exception
-
storePendingCounter
long storePendingCounter(long queueID, long pageID) throws Exception- Throws:
Exception
-
deleteIncrementRecord
void deleteIncrementRecord(long txID, long recordID) throws Exception- Throws:
Exception
-
deletePageCounter
void deletePageCounter(long txID, long recordID) throws Exception- Throws:
Exception
-
deletePendingPageCounter
void deletePendingPageCounter(long txID, long recordID) throws Exception- Throws:
Exception
-
storePageCounterInc
long storePageCounterInc(long txID, long queueID, int add, long persistentSize) throws Exception- Returns:
- the ID with the increment record
- Throws:
Exception
-
storePageCounterInc
long storePageCounterInc(long queueID, int add, long size) throws Exception- Returns:
- the ID with the increment record
- Throws:
Exception
-
getBindingsJournal
Journal getBindingsJournal()
- Returns:
- the bindings journal
-
getMessageJournal
Journal getMessageJournal()
- Returns:
- the message journal
-
startReplication
void startReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID, boolean autoFailBack, long initialReplicationSyncTimeout) throws Exception
-
addToPage
boolean addToPage(PagingStore store, Message msg, Transaction tx, RouteContextList listCtx) throws Exception
Write message to page if we are paging.- Returns:
trueif we are paging and have handled the data,falseif the data needs to be sent to the journal- Throws:
Exception
-
stopReplication
void stopReplication()
Stops the replication of data from the live to the backup.Typical scenario is a broken connection.
-
addBytesToLargeMessage
void addBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes) throws Exception
- Parameters:
appendFile-messageID-bytes-- Throws:
Exception
-
addBytesToLargeMessage
void addBytesToLargeMessage(SequentialFile file, long messageId, ActiveMQBuffer bytes) throws Exception
- Throws:
Exception
-
storeID
void storeID(long journalID, long id) throws ExceptionStores the id from IDManager.- Parameters:
journalID-id-- Throws:
Exception
-
closeableReadLock
ArtemisCloseable closeableReadLock()
Read lock the StorageManager. USE WITH CARE!The main lock is used to write lock the whole manager when starting replication. Sub-systems, say Paging classes, that use locks of their own AND also write through the StorageManager MUST first read lock the storageManager before taking their own locks. Otherwise, we may dead-lock when starting replication sync.
-
persistIdGenerator
void persistIdGenerator()
Closes theIDGeneratorpersisting the current record ID.Effectively a "pre-stop" method. Necessary due to the "stop"-order at
ActiveMQServerImpl
-
injectMonitor
void injectMonitor(FileStoreMonitor monitor) throws Exception
- Throws:
Exception
-
-