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:
  • 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

      default String getFolderName()
    • getAddressFullMessagePolicy

      AddressFullMessagePolicy getAddressFullMessagePolicy()
    • enforceAddressFullMessagePolicy

      default PagingStore enforceAddressFullMessagePolicy(AddressFullMessagePolicy enforcedAddressFullMessagePolicy)
    • getPageFullMessagePolicy

      PageFullMessagePolicy getPageFullMessagePolicy()
    • getPageLimitMessages

      Long getPageLimitMessages()
    • getPageLimitBytes

      Long getPageLimitBytes()
    • pageFull

      void pageFull(PageSubscription subscription)
      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

      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 Exception
      Performs 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:
      true if we are paging and have handled the data, false if the data needs to be sent to the journal
      Throws:
      NullPointerException - if readLock is null
      Exception
    • page

      int page(Message message, Transaction tx, RouteContextList listCtx, Function<Message,Message> pageDecorator, boolean useFlowControl) throws Exception
      Throws:
      Exception
    • 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.
    • usePage

      Page usePage(long page, boolean createEntry, boolean createFile)
    • newPageObject

      Page newPageObject(long page) throws Exception
      Throws:
      Exception
    • checkPageFileExists

      boolean checkPageFileExists(long page) throws Exception
      Throws:
      Exception
    • getPagingManager

      PagingManager getPagingManager()
    • getCursorProvider

      PageCursorProvider getCursorProvider()
    • processReload

      void processReload() throws Exception
      Throws:
      Exception
    • 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)
    • forceAnotherPage

      default void forceAnotherPage() throws Exception
      Throws:
      Exception
    • forceAnotherPage

      void forceAnotherPage(boolean useExecutor) throws Exception
      Throws:
      Exception
    • getCurrentPage

      Page getCurrentPage()
    • counterSnapshot

      void counterSnapshot()
      Save snapshots on the counters
    • startPaging

      boolean startPaging() throws Exception
      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

      void stopPaging() throws Exception
      Throws:
      Exception
    • addSize

      void addSize(int size, boolean sizeOnly, boolean affectGlobal)
      Add size to this PageStore.
      Parameters:
      sizeOnly - if false we 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

      boolean checkMemory(Runnable runnable, Consumer<AtomicRunnable> blockedCallback)
    • 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:
      true if the lock was obtained, false otherwise
    • writeUnlock

      void writeUnlock()
      Releases locks acquired with writeLock(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

      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 the ReplicationManager.

      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

      void destroy() throws Exception
      Throws:
      Exception
    • getAddressLimitPercent

      int getAddressLimitPercent()
    • block

      void block()
    • unblock

      void unblock()
    • hasPendingIO

      default boolean hasPendingIO()
    • getStorageManager

      default StorageManager getStorageManager()
    • writeFlowControl

      default void writeFlowControl(int credits)