Class JournalStorageManager
- java.lang.Object
-
- org.apache.activemq.artemis.utils.critical.CriticalComponentImpl
-
- org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager
-
- org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager
-
- All Implemented Interfaces:
StorageManager,ActiveMQComponent,CriticalComponent,IDGenerator
- Direct Known Subclasses:
JDBCJournalStorageManager
public class JournalStorageManager extends AbstractJournalStorageManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager
AbstractJournalStorageManager.JournalContent
-
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.persistence.StorageManager
StorageManager.LargeMessageExtension
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTIVEMQ_DATAprotected SequentialFileFactorybindingsFFprotected SequentialFileFactoryjournalFFprotected StringlargeMessagesDirectoryprotected SequentialFileFactorylargeMessagesFactoryprotected JournaloriginalBindingsJournalprotected JournaloriginalMessageJournalprotected ReplicationManagerreplicator-
Fields inherited from class org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager
bindingsJournal, config, CRITICAL_PATHS, CRITICAL_STOP, CRITICAL_STOP_2, CRITICAL_STORE, dummyCloseable, executorFactory, idGenerator, ioCriticalErrorListener, ioExecutorFactory, journalLoaded, largeMessagesToDelete, mapPersistedAddressSettings, mapPersistedDivertConfigurations, mapPersistedKeyValuePairs, mapPersistedRoles, mapPersistedSecuritySettings, mapPersistedUsers, messageJournal, scheduledExecutorService, started, storageManagerLock, unlockCloseable
-
-
Constructor Summary
Constructors Constructor Description JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ScheduledExecutorService scheduledExecutorService, ExecutorFactory ioExecutors)JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ScheduledExecutorService scheduledExecutorService, ExecutorFactory ioExecutors, IOCriticalErrorListener criticalErrorListener)JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ExecutorFactory ioExecutors)JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ExecutorFactory ioExecutors, IOCriticalErrorListener criticalErrorListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBytesToLargeMessage(SequentialFile file, long messageId, byte[] bytes)voidaddBytesToLargeMessage(SequentialFile file, long messageId, ActiveMQBuffer bytes)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.protected voidbeforeStart()protected voidbeforeStop()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.protected JournalcreateMessageJournal(Configuration config, IOCriticalErrorListener criticalErrorListener, int fileSize)voiddeleteLargeMessageBody(LargeServerMessage largeServerMessage)protected intfixJournalFileSize(int fileSize, int alignment)We need to correct the file size if its not a multiple of the alignementvoidfreeDirectBuffer(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.SequentialFileFactorygetJournalSequentialFileFactory()protected voidinit(Configuration config, IOCriticalErrorListener criticalErrorListener)Called during initialization.voidinjectMonitor(FileStoreMonitor monitor)booleanisReplicated()voidlargeMessageClosed(LargeServerMessage largeServerMessage)LargeServerMessagelargeMessageCreated(long id, LargeServerMessage largeMessage)voidpageClosed(SimpleString storeName, long pageNumber)voidpageDeleted(SimpleString storeName, long pageNumber)voidpageWrite(PagedMessage message, long pageNumber)protected LargeServerMessageparseLargeMessage(ActiveMQBuffer buff)protected voidperformCachedLargeMessageDeletes()Assumption is that this is only called with a writeLock on the StorageManager.voidstartReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID, boolean autoFailBack, long initialReplicationSyncTimeout)voidstop()voidstop(boolean ioCriticalError, boolean sendFailover)voidstopReplication()Stops replication by resetting replication-related fields to their 'unreplicated' state.longstorePendingLargeMessage(long messageID)-
Methods inherited from class org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager
addAddressBinding, addGrouping, addQueueBinding, addToPage, afterCompleteOperations, afterStoreOperations, checkInvalidPageTransactions, clearContext, closeableReadLock, commit, commit, commitBindings, confirmLargeMessage, confirmPendingLargeMessage, confirmPendingLargeMessageTX, criticalError, deleteAddressBinding, deleteAddressSetting, deleteAddressStatus, deleteCursorAcknowledge, deleteCursorAcknowledgeTransactional, deleteDivertConfiguration, deleteDuplicateID, deleteDuplicateIDTransactional, deleteGrouping, deleteHeuristicCompletion, deleteID, deleteIncrementRecord, deleteKeyValuePair, deleteMessage, deletePageComplete, deletePageCounter, deletePageTransactional, deletePendingPageCounter, deleteQueueBinding, deleteQueueStatus, deleteRole, deleteSecuritySetting, deleteUser, generateID, getBindingsJournal, getConfig, getContext, getCurrentID, getIDGenerator, getMaxRecordSize, getMessageJournal, getPersistedKeyValuePairs, getPersistedRoles, getPersistedUsers, isStarted, lineUpContext, loadBindingJournal, loadInternalOnly, loadMessageJournal, newAddressBindingEncoding, newContext, newQueueBindingEncoding, newQueueStatusEncoding, newSecurityRecord, newSingleThreadContext, persistIdGenerator, prepare, recoverAddressSettings, recoverDivertConfigurations, recoverSecuritySettings, rollback, rollbackBindings, setContext, start, storeAcknowledge, storeAcknowledgeTransactional, storeAddressSetting, storeAddressStatus, storeCursorAcknowledge, storeCursorAcknowledgeTransactional, storeDivertConfiguration, storeDuplicateID, storeDuplicateIDTransactional, storeHeuristicCompletion, storeID, storeKeyValuePair, storeMessage, storeMessageTransactional, storePageCompleteTransactional, storePageCounter, storePageCounterInc, storePageCounterInc, storePageTransaction, storePendingCounter, storeQueueStatus, storeReference, storeReferenceTransactional, storeRole, storeSecuritySetting, storeUser, updateDeliveryCount, updateDuplicateIDTransactional, updatePageTransaction, updateQueueBinding, updateScheduledDeliveryTime, updateScheduledDeliveryTimeTransactional, waitOnOperations, waitOnOperations
-
Methods inherited from class org.apache.activemq.artemis.utils.critical.CriticalComponentImpl
checkExpiration, getCriticalAnalyzer, measureCritical
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
Methods inherited from interface org.apache.activemq.artemis.core.persistence.StorageManager
createFileForLargeMessage
-
-
-
-
Field Detail
-
ACTIVEMQ_DATA
public static final String ACTIVEMQ_DATA
- See Also:
- Constant Field Values
-
journalFF
protected SequentialFileFactory journalFF
-
bindingsFF
protected SequentialFileFactory bindingsFF
-
largeMessagesFactory
protected SequentialFileFactory largeMessagesFactory
-
originalMessageJournal
protected Journal originalMessageJournal
-
originalBindingsJournal
protected Journal originalBindingsJournal
-
largeMessagesDirectory
protected String largeMessagesDirectory
-
replicator
protected ReplicationManager replicator
-
-
Constructor Detail
-
JournalStorageManager
public JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ScheduledExecutorService scheduledExecutorService, ExecutorFactory ioExecutors)
-
JournalStorageManager
public JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ExecutorFactory ioExecutors)
-
JournalStorageManager
public JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ScheduledExecutorService scheduledExecutorService, ExecutorFactory ioExecutors, IOCriticalErrorListener criticalErrorListener)
-
JournalStorageManager
public JournalStorageManager(Configuration config, CriticalAnalyzer analyzer, ExecutorFactory executorFactory, ExecutorFactory ioExecutors, IOCriticalErrorListener criticalErrorListener)
-
-
Method Detail
-
getJournalSequentialFileFactory
public SequentialFileFactory getJournalSequentialFileFactory()
-
init
protected void init(Configuration config, IOCriticalErrorListener criticalErrorListener)
Description copied from class:AbstractJournalStorageManagerCalled during initialization. Used by implementations to setup Journals, Stores etc...- Specified by:
initin classAbstractJournalStorageManager
-
fixJournalFileSize
protected int fixJournalFileSize(int fileSize, int alignment)We need to correct the file size if its not a multiple of the alignement- Parameters:
fileSize- : the configured file size.alignment- : the alignment.- Returns:
- the fixed file size.
-
createMessageJournal
protected Journal createMessageJournal(Configuration config, IOCriticalErrorListener criticalErrorListener, int fileSize)
-
beforeStart
protected void beforeStart() throws Exception- Specified by:
beforeStartin classAbstractJournalStorageManager- Throws:
Exception
-
beforeStop
protected void beforeStop() throws Exception- Specified by:
beforeStopin classAbstractJournalStorageManager- Throws:
Exception
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceActiveMQComponent- Overrides:
stopin classAbstractJournalStorageManager- Throws:
Exception
-
isReplicated
public boolean isReplicated()
-
stop
public void stop(boolean ioCriticalError, boolean sendFailover) throws Exception- Specified by:
stopin interfaceStorageManager- Overrides:
stopin classAbstractJournalStorageManager- 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
-
performCachedLargeMessageDeletes
protected void performCachedLargeMessageDeletes()
Assumption is that this is only called with a writeLock on the StorageManager.- Specified by:
performCachedLargeMessageDeletesin classAbstractJournalStorageManager
-
parseLargeMessage
protected LargeServerMessage parseLargeMessage(ActiveMQBuffer buff) throws Exception
- Specified by:
parseLargeMessagein classAbstractJournalStorageManager- Throws:
Exception
-
pageClosed
public void pageClosed(SimpleString storeName, long pageNumber)
-
pageDeleted
public void pageDeleted(SimpleString storeName, long pageNumber)
-
pageWrite
public void pageWrite(PagedMessage message, long pageNumber)
-
allocateDirectBuffer
public ByteBuffer allocateDirectBuffer(int size)
Description copied from interface:StorageManagerAIO 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
public void freeDirectBuffer(ByteBuffer buffer)
Description copied from interface:StorageManagerAIO 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
-
storePendingLargeMessage
public long storePendingLargeMessage(long messageID) throws Exception- Throws:
Exception
-
largeMessageClosed
public void largeMessageClosed(LargeServerMessage largeServerMessage) throws ActiveMQException
- Throws:
ActiveMQException
-
deleteLargeMessageBody
public void deleteLargeMessageBody(LargeServerMessage largeServerMessage) throws ActiveMQException
- Throws:
ActiveMQException
-
createLargeMessage
public LargeServerMessage createLargeMessage()
-
createLargeMessage
public LargeServerMessage createLargeMessage(long id, Message message) throws Exception
Description copied from interface:StorageManagerCreates a new LargeMessage with the given 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
public LargeServerMessage largeMessageCreated(long id, LargeServerMessage largeMessage) throws Exception
- Throws:
Exception
-
createFileForLargeMessage
public SequentialFile createFileForLargeMessage(long messageID, StorageManager.LargeMessageExtension extension)
Description copied from interface:StorageManagerInstantiates a SequentialFile to be used for storing aLargeServerMessage.- Parameters:
messageID- the id of the messageextension- the extension to add to the file- Returns:
-
startReplication
public void startReplication(ReplicationManager replicationManager, PagingManager pagingManager, String nodeID, boolean autoFailBack, long initialReplicationSyncTimeout) throws Exception
-
stopReplication
public void stopReplication()
Stops replication by resetting replication-related fields to their 'unreplicated' state.
-
addBytesToLargeMessage
public final void addBytesToLargeMessage(SequentialFile file, long messageId, ActiveMQBuffer bytes) throws Exception
- Throws:
Exception
-
addBytesToLargeMessage
public final void addBytesToLargeMessage(SequentialFile file, long messageId, byte[] bytes) throws Exception
- Throws:
Exception
-
injectMonitor
public void injectMonitor(FileStoreMonitor monitor) throws Exception
- Throws:
Exception
-
-