Interface PagingStore
-
- All Superinterfaces:
ActiveMQComponent,RefCountMessageListener
- All Known Implementing Classes:
PagingStoreImpl
public interface PagingStore extends ActiveMQComponent, RefCountMessageListener
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:
PagingManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidaddSize(int size)voidaddSize(int size, boolean sizeOnly)voidapplySetting(AddressSettings addressSettings)voidblock()booleancheckMemory(boolean runOnFailure, Runnable runnable, Runnable runWhenBlocking)booleancheckMemory(Runnable runnable)booleancheckPageFileExists(long page)booleancheckReleasedMemory()It will return true if the destination is leaving blocking.Pagedepage()Remove the first page from the Writing Queue.voiddestroy()voiddisableCleanup()This method will disable cleanup of pages.voidenableCleanup()This method will re-enable cleanup of pages.voidexecute(Runnable runnable)voidflushExecutors()This is used mostly by tests.voidforceAnotherPage()SimpleStringgetAddress()AddressFullMessagePolicygetAddressFullMessagePolicy()intgetAddressLimitPercent()longgetAddressSize()Collection<Integer>getCurrentIds()Files to synchronize with a remote backup.PagegetCurrentPage()longgetCurrentWritingPage()Returns the page id of the current page in which the system is writing files.PageCursorProvidergetCursorProvider()ArtemisExecutorgetExecutor()longgetFirstPage()FilegetFolder()intgetMaxPageReadBytes()intgetMaxPageReadMessages()longgetMaxSize()longgetNumberOfPages()intgetPageSizeBytes()PagingManagergetPagingManager()SimpleStringgetStoreName()voidioSync()Performs a real sync on the current IO file.booleanisFull()booleanisPaging()This method will look if the current state of paging is not paging, without using a lock.booleanisRejectingMessages()booleanlock(long timeout)Write lock the PagingStore.PagenewPageObject(long page)booleanpage(Message message, Transaction tx, RouteContextList listCtx)Write message to page if we are paging.voidprocessReload()PageremovePage(int pageId)voidsendPages(ReplicationManager replicator, Collection<Integer> pageIds)Sends the pages with given IDs to theReplicationManager.booleanstartPaging()voidstopPaging()voidsync()Schedules sync to the file storage.voidunblock()voidunlock()Releases locks acquired withlock(long).PageusePage(long page)PageusePage(long page, boolean create)Use this method when you want to use the cache of used pages.-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop, isStarted, start, stop
-
Methods inherited from interface org.apache.activemq.artemis.api.core.RefCountMessageListener
durableDown, durableUp, refDown, refUp, usageDown, usageUp
-
-
-
-
Method Detail
-
getAddress
SimpleString getAddress()
-
getNumberOfPages
long getNumberOfPages()
-
getCurrentWritingPage
long getCurrentWritingPage()
Returns the page id of the current page in which the system is writing files.
-
getStoreName
SimpleString getStoreName()
-
getFolder
File getFolder()
-
getAddressFullMessagePolicy
AddressFullMessagePolicy getAddressFullMessagePolicy()
-
getFirstPage
long getFirstPage()
-
getPageSizeBytes
int getPageSizeBytes()
-
getAddressSize
long getAddressSize()
-
getMaxSize
long getMaxSize()
-
getMaxPageReadBytes
int getMaxPageReadBytes()
-
getMaxPageReadMessages
int getMaxPageReadMessages()
-
applySetting
void applySetting(AddressSettings addressSettings)
-
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
void ioSync() throws ExceptionPerforms a real sync on the current IO file.- Throws:
Exception
-
page
boolean page(Message message, 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:
NullPointerException- ifreadLockis nullException
-
usePage
Page usePage(long page)
-
usePage
Page usePage(long page, boolean create)
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.
-
getPagingManager
PagingManager getPagingManager()
-
getCursorProvider
PageCursorProvider getCursorProvider()
-
depage
Page depage() throws Exception
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
Page removePage(int pageId)
-
getCurrentPage
Page getCurrentPage()
-
startPaging
boolean startPaging() throws Exception- Returns:
- true if paging was started, or false if paging was already started before this call
- Throws:
Exception
-
addSize
void addSize(int size, boolean sizeOnly)- Parameters:
size-sizeOnly- if false we won't increment the number of messages. (add references for example)
-
addSize
default void addSize(int size)
-
checkMemory
boolean checkMemory(Runnable runnable)
-
isFull
boolean isFull()
-
isRejectingMessages
boolean isRejectingMessages()
-
checkReleasedMemory
boolean checkReleasedMemory()
It will return true if the destination is leaving blocking.
-
lock
boolean lock(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
-
unlock
void unlock()
Releases locks acquired withlock(long).
-
flushExecutors
void flushExecutors()
This is used mostly by tests. We will wait any pending runnable to finish its execution
-
execute
void execute(Runnable runnable)
-
getExecutor
ArtemisExecutor getExecutor()
-
getCurrentIds
Collection<Integer> getCurrentIds() throws Exception
Files to synchronize with a remote backup.- Returns:
- a collection of page IDs which must be synchronized with a replicating backup
- Throws:
Exception
-
sendPages
void sendPages(ReplicationManager replicator, Collection<Integer> pageIds) throws Exception
Sends the pages with given IDs to theReplicationManager.Sending is done here to avoid exposing the internal
SequentialFiles.- Parameters:
replicator-pageIds-- 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.
-
getAddressLimitPercent
int getAddressLimitPercent()
-
block
void block()
-
unblock
void unblock()
-
-