Class PageCursorProviderImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl
-
- All Implemented Interfaces:
PageCursorProvider
public class PageCursorProviderImpl extends Object implements PageCursorProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancleanupEnabledprotected PagingStorepagingStoreprotected AtomicIntegerscheduledCleanupAs an optimization, avoid subsequent schedules as they are unnecessaryprotected StorageManagerstorageManager
-
Constructor Summary
Constructors Constructor Description PageCursorProviderImpl(PagingStore pagingStore, StorageManager storageManager, ArtemisExecutor executor, int maxCacheSize)PageCursorProviderImpl(PagingStore pagingStore, StorageManager storageManager, ArtemisExecutor executor, int maxCacheSize, boolean readWholePage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLivePageCache(LivePageCache cache)voidcleanup()Perform the cleanup at the caller's thread (for startup and recovery)protected voidcleanupComplete(ArrayList<PageSubscription> cursorList)voidclearCache()Used on tests, to simulate a scenario where the VM cleared spacevoidclose(PageSubscription cursor)PageSubscriptioncreateSubscription(long cursorID, Filter filter, boolean persistent)voiddisableCleanup()protected voidfinishCleanup(ArrayList<Page> depagedPages)voidflushExecutors()intgetCacheSize()PagedMessagegetMessage(PagePosition pos)PageCachegetPageCache(long pageId)PageSubscriptiongetSubscription(long cursorID)PagedReferencenewReference(PagePosition pos, PagedMessage msg, PageSubscription subscription)protected voidonDeletePage(Page deletedPage)voidonPageModeCleared()Delete everything associated with any queue on this address.voidprintDebug()voidprocessReload()voidresumeCleanup()voidscheduleCleanup()voidsetCacheMaxSize(int size)voidstop()protected voidstoreBookmark(ArrayList<PageSubscription> cursorList, Page currentPage)StringtoString()
-
-
-
Field Detail
-
scheduledCleanup
protected final AtomicInteger scheduledCleanup
As an optimization, avoid subsequent schedules as they are unnecessary
-
cleanupEnabled
protected volatile boolean cleanupEnabled
-
pagingStore
protected final PagingStore pagingStore
-
storageManager
protected final StorageManager storageManager
-
-
Constructor Detail
-
PageCursorProviderImpl
public PageCursorProviderImpl(PagingStore pagingStore, StorageManager storageManager, ArtemisExecutor executor, int maxCacheSize)
-
PageCursorProviderImpl
public PageCursorProviderImpl(PagingStore pagingStore, StorageManager storageManager, ArtemisExecutor executor, int maxCacheSize, boolean readWholePage)
-
-
Method Detail
-
createSubscription
public PageSubscription createSubscription(long cursorID, Filter filter, boolean persistent)
- Specified by:
createSubscriptionin interfacePageCursorProvider
-
getSubscription
public PageSubscription getSubscription(long cursorID)
- Specified by:
getSubscriptionin interfacePageCursorProvider- Parameters:
cursorID- The cursorID should be the same as the queueId associated for persistence- Returns:
-
getMessage
public PagedMessage getMessage(PagePosition pos)
- Specified by:
getMessagein interfacePageCursorProvider
-
newReference
public PagedReference newReference(PagePosition pos, PagedMessage msg, PageSubscription subscription)
- Specified by:
newReferencein interfacePageCursorProvider
-
getPageCache
public PageCache getPageCache(long pageId)
- Specified by:
getPageCachein interfacePageCursorProvider
-
addLivePageCache
public void addLivePageCache(LivePageCache cache)
- Specified by:
addLivePageCachein interfacePageCursorProvider
-
setCacheMaxSize
public void setCacheMaxSize(int size)
- Specified by:
setCacheMaxSizein interfacePageCursorProvider
-
getCacheSize
public int getCacheSize()
- Specified by:
getCacheSizein interfacePageCursorProvider
-
clearCache
public void clearCache()
Description copied from interface:PageCursorProviderUsed on tests, to simulate a scenario where the VM cleared space- Specified by:
clearCachein interfacePageCursorProvider
-
processReload
public void processReload() throws Exception- Specified by:
processReloadin interfacePageCursorProvider- Throws:
Exception
-
stop
public void stop()
- Specified by:
stopin interfacePageCursorProvider
-
flushExecutors
public void flushExecutors()
- Specified by:
flushExecutorsin interfacePageCursorProvider
-
close
public void close(PageSubscription cursor)
- Specified by:
closein interfacePageCursorProvider
-
scheduleCleanup
public void scheduleCleanup()
- Specified by:
scheduleCleanupin interfacePageCursorProvider
-
onPageModeCleared
public void onPageModeCleared()
Delete everything associated with any queue on this address. This is to be called when the address is about to be released from paging. Hence the PagingStore will be holding a write lock, meaning no messages are going to be paged at this time. So, we shouldn't lock anything after this method, to avoid dead locks between the writeLock and any synchronization with the CursorProvider.- Specified by:
onPageModeClearedin interfacePageCursorProvider
-
disableCleanup
public void disableCleanup()
- Specified by:
disableCleanupin interfacePageCursorProvider
-
resumeCleanup
public void resumeCleanup()
- Specified by:
resumeCleanupin interfacePageCursorProvider
-
cleanup
public void cleanup()
Description copied from interface:PageCursorProviderPerform the cleanup at the caller's thread (for startup and recovery)- Specified by:
cleanupin interfacePageCursorProvider
-
cleanupComplete
protected void cleanupComplete(ArrayList<PageSubscription> cursorList) throws Exception
- Throws:
Exception
-
storeBookmark
protected void storeBookmark(ArrayList<PageSubscription> cursorList, Page currentPage) throws Exception
- Parameters:
cursorList-currentPage-- Throws:
Exception
-
printDebug
public void printDebug()
- Specified by:
printDebugin interfacePageCursorProvider
-
-