org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl

Here are the examples of the java api class org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl taken from open source projects.

1. PageCursorStressTest#testReadCache()

View license
// Read more cache than what would fit on the memory, and validate if the memory would be cleared through soft-caches
@Test
public void testReadCache() throws Exception {
    final int NUM_MESSAGES = 100;
    int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
    System.out.println("NumberOfPages = " + numberOfPages);
    PageCursorProviderImpl cursorProvider = new PageCursorProviderImpl(lookupPageStore(ADDRESS), server.getStorageManager(), server.getExecutorFactory().getExecutor(), 5);
    for (int i = 0; i < numberOfPages; i++) {
        PageCache cache = cursorProvider.getPageCache(i + 1);
        System.out.println("Page " + i + " had " + cache.getNumberOfMessages() + " messages");
    }
    forceGC();
    assertTrue(cursorProvider.getCacheSize() < numberOfPages);
    System.out.println("Cache size = " + cursorProvider.getCacheSize());
}