Interface PagingStore
- All Superinterfaces:
ActiveMQComponent,RefCountMessageListener
- All Known Implementing Classes:
PagingStoreImpl
The implementation will take care of details such as PageSize.
The producers will write directly to PagingStore, and the store will decide what Page file should be used based on configured size.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddSize(int size) default voidaddSize(int size, boolean sizeOnly) voidaddSize(int size, boolean sizeOnly, boolean affectGlobal) Add size to thisPageStore.voidapplySetting(AddressSettings addressSettings) voidblock()booleancheckMemory(boolean runOnFailure, Runnable runnable, Runnable runWhenBlocking, Consumer<AtomicRunnable> blockedCallback) booleancheckMemory(Runnable runnable, Consumer<AtomicRunnable> blockedCallback) booleancheckPageFileExists(long page) voidcheckPageLimit(long numberOfMessages) booleanIt will return true if the destination is leaving blocking.voidSave snapshots on the countersdepage()Remove the first page from the Writing Queue.voiddestroy()voidThis method will disable cleanup of pages.voidThis method will re-enable cleanup of pages.default PagingStoreenforceAddressFullMessagePolicy(AddressFullMessagePolicy enforcedAddressFullMessagePolicy) voidvoidThis is used mostly by tests.default voidvoidforceAnotherPage(boolean useExecutor) longintlongFiles to synchronize with a remote backup.longReturns the page id of the current page in which the system is writing files.longdefault Stringintintlonglongintintintdefault StorageManagerdefault booleanvoidioSync()Performs a real sync on the current IO file.booleanisFull()booleanbooleanisPaging()This method will look if the current state of paging is not paging, without using a lock.booleannewPageObject(long page) booleanpage(Message message, Transaction tx, RouteContextList listCtx) Write message to page if we are paging.intpage(Message message, Transaction tx, RouteContextList listCtx, Function<Message, Message> pageDecorator, boolean useFlowControl) voidpageFull(PageSubscription subscription) Callback to be used by a counter when the Page is full for that countervoidvoidreadLock()booleanreadLock(long timeout) voidremovePage(int pageId) voidsendPages(ReplicationManager replicator, Collection<Integer> pageIds) Sends the pages with given IDs to theReplicationManager.booleanReturns true if paging was started, or false if paging was already started before this call.voidvoidunblock()usePage(long page) usePage(long page, boolean create) Use this method when you want to use the cache of used pages.usePage(long page, boolean createEntry, boolean createFile) default voidwriteFlowControl(int credits) voidbooleanwriteLock(long timeout) Write lock the PagingStore.voidReleases locks acquired withwriteLock(long).Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop, isStarted, start, stopMethods inherited from interface org.apache.activemq.artemis.api.core.RefCountMessageListener
durableDown, durableUp, refDown, refUp, usageDown, usageUp
-
Method Details
-
getAddress
SimpleString getAddress() -
getNumberOfPages
long getNumberOfPages() -
getCurrentWritingPage
long getCurrentWritingPage()Returns the page id of the current page in which the system is writing files.- Returns:
- the page id of the current page in which the system is writing files
-
getStoreName
SimpleString getStoreName() -
getFolder
File getFolder() -
getFolderName
-
getAddressFullMessagePolicy
AddressFullMessagePolicy getAddressFullMessagePolicy() -
enforceAddressFullMessagePolicy
default PagingStore enforceAddressFullMessagePolicy(AddressFullMessagePolicy enforcedAddressFullMessagePolicy) -
getPageFullMessagePolicy
PageFullMessagePolicy getPageFullMessagePolicy() -
getPageLimitMessages
Long getPageLimitMessages() -
getPageLimitBytes
Long getPageLimitBytes() -
pageFull
Callback to be used by a counter when the Page is full for that counter -
isPageFull
boolean isPageFull() -
checkPageLimit
void checkPageLimit(long numberOfMessages) -
getFirstPage
long getFirstPage() -
getPageSizeBytes
int getPageSizeBytes() -
getAddressSize
long getAddressSize() -
getAddressElements
long getAddressElements() -
getMaxSize
long getMaxSize() -
getMaxPageReadBytes
int getMaxPageReadBytes() -
getMaxPageReadMessages
int getMaxPageReadMessages() -
getPrefetchPageBytes
int getPrefetchPageBytes() -
getPrefetchPageMessages
int getPrefetchPageMessages() -
applySetting
-
isPaging
boolean isPaging()This method will look if the current state of paging is not paging, without using a lock. For cases where you need absolutely atomic results, check it directly on the internal variables while requiring a readLock.It's ok to look for this with an estimate on starting a task or not, but you will need to recheck on actual paging operations.
-
ioSync
Performs a real sync on the current IO file.- Throws:
Exception
-
page
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:
NullPointerException- ifreadLockis nullException
-
page
int page(Message message, Transaction tx, RouteContextList listCtx, Function<Message, Message> pageDecorator, boolean useFlowControl) throws Exception- Throws:
Exception
-
usePage
-
usePage
Use this method when you want to use the cache of used pages. If you are just using offline (e.g. print-data), use the newPageObject method. -
usePage
-
newPageObject
- Throws:
Exception
-
checkPageFileExists
- Throws:
Exception
-
getPagingManager
PagingManager getPagingManager() -
getCursorProvider
PageCursorProvider getCursorProvider() -
processReload
- Throws:
Exception
-
depage
Remove the first page from the Writing Queue. The file will still exist until Page.delete is called, So, case the system is reloaded the same Page will be loaded back if delete is not called.- Throws:
Exception- Note: This should still be part of the interface, even though ActiveMQ Artemis only uses through the
-
removePage
-
forceAnotherPage
- Throws:
Exception
-
forceAnotherPage
- Throws:
Exception
-
getCurrentPage
Page getCurrentPage() -
counterSnapshot
void counterSnapshot()Save snapshots on the counters -
startPaging
Returns true if paging was started, or false if paging was already started before this call.- Returns:
- true if paging was started, or false if paging was already started before this call
- Throws:
Exception
-
stopPaging
- Throws:
Exception
-
addSize
void addSize(int size, boolean sizeOnly, boolean affectGlobal) Add size to thisPageStore.- Parameters:
sizeOnly- iffalsewe won't increment the number of messages. (add references for example)
-
addSize
default void addSize(int size, boolean sizeOnly) -
addSize
default void addSize(int size) -
checkMemory
-
checkMemory
boolean checkMemory(boolean runOnFailure, Runnable runnable, Runnable runWhenBlocking, Consumer<AtomicRunnable> blockedCallback) -
isFull
boolean isFull() -
isRejectingMessages
boolean isRejectingMessages() -
checkReleasedMemory
boolean checkReleasedMemory()It will return true if the destination is leaving blocking. -
writeLock
void writeLock() -
writeLock
boolean writeLock(long timeout) Write lock the PagingStore.- Parameters:
timeout- milliseconds to wait for the lock. If value is -1 then wait indefinitely.- Returns:
trueif the lock was obtained,falseotherwise
-
writeUnlock
void writeUnlock()Releases locks acquired withwriteLock(long). -
readLock
void readLock() -
readLock
boolean readLock(long timeout) -
readUnlock
void readUnlock() -
flushExecutors
void flushExecutors()This is used mostly by tests. We will wait any pending runnable to finish its execution -
execute
-
getExecutor
ArtemisExecutor getExecutor() -
getCurrentIds
Files to synchronize with a remote backup.- Returns:
- a collection of page IDs which must be synchronized with a replicating backup
- Throws:
Exception
-
sendPages
Sends the pages with given IDs to theReplicationManager.Sending is done here to avoid exposing the internal
SequentialFiles.- Throws:
Exception
-
disableCleanup
void disableCleanup()This method will disable cleanup of pages. No page will be deleted after this call. -
enableCleanup
void enableCleanup()This method will re-enable cleanup of pages. Notice that it will also start cleanup threads. -
destroy
- Throws:
Exception
-
getAddressLimitPercent
int getAddressLimitPercent() -
block
void block() -
unblock
void unblock() -
hasPendingIO
default boolean hasPendingIO() -
getStorageManager
-
writeFlowControl
default void writeFlowControl(int credits)
-