Interface StorageManager
- All Superinterfaces:
ActiveMQComponent,IDGenerator,MapStorageManager
- All Known Implementing Classes:
AbstractJournalStorageManager,JDBCJournalStorageManager,JournalStorageManager,NullStorageManager
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddressBinding(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.voidvoidafterCompleteOperations(IOCallback run, OperationConsistencyLevel consistencyLevel) voidThis is similar to afterComplete, however this only cares about the journal part.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.voidasyncCommit(long txID) voiddefault ArtemisCloseablecloseableReadLock(boolean tryLock) 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 finishedcreateCoreLargeMessage(long id, Message message) Creates a new LargeServerMessage for the core Protocol with the given id.default SequentialFilecreateFileForLargeMessage(long messageID, boolean durable) createFileForLargeMessage(long messageID, StorageManager.LargeMessageExtension extension) Instantiates a SequentialFile to be used for storing aLargeServerMessage.voidcriticalError(Throwable error) voiddeleteAddressBinding(long tx, long addressBindingID) voiddeleteAddressSetting(SimpleString addressMatch) voiddeleteAddressStatus(long recordID) voiddeleteBridgeConfiguration(String bridgeName) voiddeleteConnector(String connectorName) 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.default intgetAllowedPageSize(int pageSize) Get the context associated with the thread for later reusedefault SequentialFileFactorydefault longgetPersistedKeyValuePairs(String mapId) default Set<RemotingConnection>default longvoidinjectMonitor(FileStoreMonitor monitor) default booleanvoidlargeMessageClosed(LargeServerMessage largeServerMessage) voidloadBindingJournal(List<QueueBindingInfo> queueBindingInfos, List<GroupingInfo> groupingInfos, List<AddressBindingInfo> addressBindingInfos) default 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) default JournalLoadInformationloadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long, QueueBindingInfo> queueInfos, Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap, Set<Pair<Long, Long>> pendingLargeMessages, Set<Long> largeMessagesInFolder, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader) loadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long, QueueBindingInfo> queueInfos, Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap, Set<Pair<Long, Long>> pendingLargeMessages, Set<Long> largeMessagesInFolder, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader, List<Consumer<RecordInfo>> extraRecordsLoader) newContext(Executor executor) It just creates an OperationContext without associating itonLargeMessageCreate(long id, LargeServerMessage largeMessage) Other protocols may inform the storage manager when a large message was created.voidpageClosed(SimpleString address, long pageNumber) voidpageDeleted(SimpleString address, long pageNumber) voidpageWrite(SimpleString address, PagedMessage message, long pageNumber, boolean storageUp, boolean originallyReplicated) voidCloses theIDGeneratorpersisting the current record ID.voidrecoverAddressSettings(SimpleString address) default voidrecoverLargeMessagesOnFolder(Set<Long> files) 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) Stop thisStorageManagervoidStops the replication of data from the primary to the backup.voidstoreAcknowledge(long queueID, long messageID) voidstoreAcknowledgeTransactional(long txID, long queueID, long messageID) voidstoreAddressSetting(PersistedAddressSettingJSON addressSetting) longstoreAddressStatus(long addressID, AddressQueueStatus status) voidstoreBridgeConfiguration(PersistedBridgeConfiguration persistedBridgeConfiguration) voidstoreConnector(PersistedConnector persistedConnector) 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) Store the specificed page counter.longstorePageCounterInc(long queueID, int add, long size) Store the specificed page counter increment.longstorePageCounterInc(long txID, long queueID, int add, long persistentSize) Store the specificed page counter increment.voidstorePageTransaction(long txID, PageTransactionInfo pageTransaction) longstorePendingCounter(long queueID, long pageID) longstoreQueueStatus(long queueID, AddressQueueStatus status) Store a queue's status.voidstoreReference(long queueID, long messageID, boolean last) voidstoreReferenceTransactional(long txID, long queueID, long messageID) voidstoreRole(PersistedRole persistedRole) voidstoreSecuritySetting(PersistedSecuritySetting persistedRoles) voidstoreUser(PersistedUser persistedUser) voidvoidupdateDuplicateIDTransactional(long txID, SimpleString address, byte[] duplID, long recordID) voidupdatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) voidupdateQueueBinding(long tx, Binding binding) voidvoidupdateScheduledDeliveryTimeTransactional(long txID, MessageReference ref) voidBlock until the operations are done.booleanwaitOnOperations(long timeout) Block until the operations are done.default voiddefault voidMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop, isStarted, start, stopMethods inherited from interface org.apache.activemq.artemis.utils.IDGenerator
generateID, getCurrentIDMethods inherited from interface org.apache.activemq.artemis.core.journal.collections.MapStorageManager
deleteMapRecord, deleteMapRecordTx, storeMapRecord, storeMapRecord
-
Method Details
-
getMaxRecordSize
default long getMaxRecordSize() -
isReplicated
default boolean isReplicated() -
getWarningRecordSize
default long getWarningRecordSize() -
recoverLargeMessagesOnFolder
- Throws:
Exception
-
writeLock
default void writeLock() -
writeUnlock
default void writeUnlock() -
getJournalSequentialFileFactory
-
criticalError
-
getContext
OperationContext getContext()Get the context associated with the thread for later reuse -
lineUpContext
void lineUpContext() -
newContext
It just creates an OperationContext without associating it -
newSingleThreadContext
OperationContext newSingleThreadContext() -
setContext
Set the context back to the thread -
stop
Stop thisStorageManager- 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
-
getUsedConnections
-
pageClosed
-
pageDeleted
-
pageWrite
void pageWrite(SimpleString address, PagedMessage message, long pageNumber, boolean storageUp, boolean originallyReplicated) -
afterCompleteOperations
-
afterCompleteOperations
-
afterStoreOperations
This is similar to afterComplete, however this only cares about the journal part. -
waitOnOperations
Block 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
Block 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
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
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
Confirms that a large message was finished- Throws:
Exception
-
storeMessage
- Throws:
Exception
-
storeReference
- Throws:
Exception
-
deleteMessage
- Throws:
Exception
-
storeAcknowledge
- Throws:
Exception
-
storeCursorAcknowledge
- Throws:
Exception
-
updateDeliveryCount
- Throws:
Exception
-
updateScheduledDeliveryTime
- Throws:
Exception
-
storeDuplicateID
- Throws:
Exception
-
deleteDuplicateID
- Throws:
Exception
-
storeMessageTransactional
- Throws:
Exception
-
storeReferenceTransactional
- Throws:
Exception
-
storeAcknowledgeTransactional
- Throws:
Exception
-
storeCursorAcknowledgeTransactional
void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position) throws Exception - Throws:
Exception
-
deleteCursorAcknowledgeTransactional
- Throws:
Exception
-
deleteCursorAcknowledge
- Throws:
Exception
-
storePageCompleteTransactional
void storePageCompleteTransactional(long txID, long queueID, PagePosition position) throws Exception - Throws:
Exception
-
deletePageComplete
- Throws:
Exception
-
updateScheduledDeliveryTimeTransactional
- 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
- Throws:
Exception
-
createCoreLargeMessage
LargeServerMessage createCoreLargeMessage() -
createCoreLargeMessage
Creates a new LargeServerMessage for the core Protocol with the given id.- Parameters:
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
-
onLargeMessageCreate
Other protocols may inform the storage manager when a large message was created.- 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
-
largeMessageClosed
- Throws:
ActiveMQException
-
deleteLargeMessageBody
- Throws:
ActiveMQException
-
createFileForLargeMessage
-
prepare
- Throws:
Exception
-
commit
- Throws:
Exception
-
commit
- Throws:
Exception
-
asyncCommit
- Throws:
Exception
-
rollback
- Throws:
Exception
-
rollbackBindings
- Throws:
Exception
-
commitBindings
- Throws:
Exception
-
storePageTransaction
- Throws:
Exception
-
updatePageTransaction
void updatePageTransaction(long txID, PageTransactionInfo pageTransaction, int depage) throws Exception - Throws:
Exception
-
deletePageTransactional
- Throws:
Exception
-
loadMessageJournal
default JournalLoadInformation loadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long, QueueBindingInfo> queueInfos, Map<SimpleString, throws ExceptionList<Pair<byte[], Long>>> duplicateIDMap, Set<Pair<Long, Long>> pendingLargeMessages, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader) - Throws:
Exception
-
loadMessageJournal
default JournalLoadInformation loadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long, QueueBindingInfo> queueInfos, Map<SimpleString, throws ExceptionList<Pair<byte[], Long>>> duplicateIDMap, Set<Pair<Long, Long>> pendingLargeMessages, Set<Long> largeMessagesInFolder, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader) - Throws:
Exception
-
loadMessageJournal
JournalLoadInformation loadMessageJournal(PostOffice postOffice, PagingManager pagingManager, ResourceManager resourceManager, Map<Long, QueueBindingInfo> queueInfos, Map<SimpleString, throws ExceptionList<Pair<byte[], Long>>> duplicateIDMap, Set<Pair<Long, Long>> pendingLargeMessages, Set<Long> largeMessagesInFolder, List<PageCountPending> pendingNonTXPageCounter, JournalLoader journalLoader, List<Consumer<RecordInfo>> extraRecordsLoader) - Throws:
Exception
-
storeHeuristicCompletion
- Throws:
Exception
-
deleteHeuristicCompletion
- Throws:
Exception
-
addQueueBinding
- Throws:
Exception
-
updateQueueBinding
- Throws:
Exception
-
deleteQueueBinding
- Throws:
Exception
-
storeQueueStatus
Store a queue's status.- 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
-
deleteQueueStatus
- Throws:
Exception
-
storeAddressStatus
- Throws:
Exception
-
deleteAddressStatus
- Throws:
Exception
-
addAddressBinding
- Throws:
Exception
-
deleteAddressBinding
- Throws:
Exception
-
loadBindingJournal
JournalLoadInformation loadBindingJournal(List<QueueBindingInfo> queueBindingInfos, List<GroupingInfo> groupingInfos, List<AddressBindingInfo> addressBindingInfos) throws Exception - Throws:
Exception
-
addGrouping
- Throws:
Exception
-
deleteGrouping
- Throws:
Exception
-
storeAddressSetting
- Throws:
Exception
-
deleteAddressSetting
- Throws:
Exception
-
recoverAddressSettings
- Throws:
Exception
-
recoverAddressSettings
-
storeSecuritySetting
- Throws:
Exception
-
deleteSecuritySetting
- Throws:
Exception
-
recoverSecuritySettings
- Throws:
Exception
-
storeDivertConfiguration
void storeDivertConfiguration(PersistedDivertConfiguration persistedDivertConfiguration) throws Exception - Throws:
Exception
-
deleteDivertConfiguration
- Throws:
Exception
-
recoverDivertConfigurations
List<PersistedDivertConfiguration> recoverDivertConfigurations() -
storeBridgeConfiguration
void storeBridgeConfiguration(PersistedBridgeConfiguration persistedBridgeConfiguration) throws Exception - Throws:
Exception
-
deleteBridgeConfiguration
- Throws:
Exception
-
recoverBridgeConfigurations
List<PersistedBridgeConfiguration> recoverBridgeConfigurations() -
storeConnector
- Throws:
Exception
-
deleteConnector
- Throws:
Exception
-
recoverConnectors
List<PersistedConnector> recoverConnectors() -
storeUser
- Throws:
Exception
-
deleteUser
- Throws:
Exception
-
getPersistedUsers
Map<String,PersistedUser> getPersistedUsers() -
storeRole
- Throws:
Exception
-
deleteRole
- Throws:
Exception
-
getPersistedRoles
Map<String,PersistedRole> getPersistedRoles() -
storeKeyValuePair
- Throws:
Exception
-
deleteKeyValuePair
- Throws:
Exception
-
getPersistedKeyValuePairs
-
storePageCounter
Store the specificed page counter.- Returns:
- The ID with the stored counter
- Throws:
Exception
-
storePendingCounter
- Throws:
Exception
-
deleteIncrementRecord
- Throws:
Exception
-
deletePageCounter
- Throws:
Exception
-
deletePendingPageCounter
- Throws:
Exception
-
storePageCounterInc
Store the specificed page counter increment.- Returns:
- the ID with the increment record
- Throws:
Exception
-
storePageCounterInc
Store the specificed page counter increment.- Returns:
- the ID with the increment record
- Throws:
Exception
-
getBindingsJournal
Journal getBindingsJournal() -
getMessageJournal
Journal getMessageJournal() -
startReplication
void startReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID, boolean autoFailBack, long initialReplicationSyncTimeout) throws Exception - 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 primary to the backup.Typical scenario is a broken connection.
-
addBytesToLargeMessage
void addBytesToLargeMessage(SequentialFile appendFile, long messageID, byte[] bytes) throws Exception - Throws:
Exception
-
addBytesToLargeMessage
void addBytesToLargeMessage(SequentialFile file, long messageId, ActiveMQBuffer bytes) throws Exception - Throws:
Exception
-
storeID
Stores the id from IDManager.- Throws:
Exception
-
deleteID
- Throws:
Exception
-
closeableReadLock
-
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
- Throws:
Exception
-
getAllowedPageSize
default int getAllowedPageSize(int pageSize)
-