org.apache.activemq.artemis.core.paging.PagingManager

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

1. ReplicationTest#createPageManager()

View license
protected PagingManager createPageManager(final StorageManager storageManager, final Configuration configuration, final ExecutorFactory executorFactory, final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception {
    PagingManager paging = new PagingManagerImpl(new PagingStoreFactoryNIO(storageManager, configuration.getPagingLocation(), 1000, null, executorFactory, false, null), addressSettingsRepository);
    paging.start();
    return paging;
}

2. PagingTest#testSyncPageTX()

Project: activemq-artemis
Source File: PagingTest.java
View license
@Test
public void testSyncPageTX() throws Exception {
    Configuration config = createDefaultInVMConfig();
    server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, new HashMap<String, AddressSettings>());
    server.start();
    server.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true, false);
    final CountDownLatch pageUp = new CountDownLatch(0);
    final CountDownLatch pageDone = new CountDownLatch(1);
    OperationContext ctx = new DummyOperationContext(pageUp, pageDone);
    OperationContextImpl.setContext(ctx);
    PagingManager paging = server.getPagingManager();
    PagingStore store = paging.getPageStore(ADDRESS);
    store.sync();
    assertTrue(pageUp.await(10, TimeUnit.SECONDS));
    assertTrue(pageDone.await(10, TimeUnit.SECONDS));
}

3. ReplicationTest#testSendPackets()

View license
@Test
public void testSendPackets() throws Exception {
    setupServer(true);
    StorageManager storage = getStorage();
    manager = liveServer.getReplicationManager();
    waitForComponent(manager);
    Journal replicatedJournal = new ReplicatedJournal((byte) 1, new FakeJournal(), manager);
    replicatedJournal.appendPrepareRecord(1, new FakeData(), false);
    replicatedJournal.appendAddRecord(1, (byte) 1, new FakeData(), false);
    replicatedJournal.appendUpdateRecord(1, (byte) 2, new FakeData(), false);
    replicatedJournal.appendDeleteRecord(1, false);
    replicatedJournal.appendAddRecordTransactional(2, 2, (byte) 1, new FakeData());
    replicatedJournal.appendUpdateRecordTransactional(2, 2, (byte) 2, new FakeData());
    replicatedJournal.appendCommitRecord(2, false);
    replicatedJournal.appendDeleteRecordTransactional(3, 4, new FakeData());
    replicatedJournal.appendPrepareRecord(3, new FakeData(), false);
    replicatedJournal.appendRollbackRecord(3, false);
    blockOnReplication(storage, manager);
    Assert.assertTrue("Expecting no active tokens:" + manager.getActiveTokens(), manager.getActiveTokens().isEmpty());
    ServerMessage msg = new ServerMessageImpl(1, 1024);
    SimpleString dummy = new SimpleString("dummy");
    msg.setAddress(dummy);
    replicatedJournal.appendAddRecordTransactional(23, 24, (byte) 1, new FakeData());
    PagedMessage pgmsg = new PagedMessageImpl(msg, new long[0]);
    manager.pageWrite(pgmsg, 1);
    manager.pageWrite(pgmsg, 2);
    manager.pageWrite(pgmsg, 3);
    manager.pageWrite(pgmsg, 4);
    blockOnReplication(storage, manager);
    PagingManager pagingManager = createPageManager(backupServer.getStorageManager(), backupServer.getConfiguration(), backupServer.getExecutorFactory(), backupServer.getAddressSettingsRepository());
    PagingStore store = pagingManager.getPageStore(dummy);
    store.start();
    Assert.assertEquals(4, store.getNumberOfPages());
    store.stop();
    manager.pageDeleted(dummy, 1);
    manager.pageDeleted(dummy, 2);
    manager.pageDeleted(dummy, 3);
    manager.pageDeleted(dummy, 4);
    manager.pageDeleted(dummy, 5);
    manager.pageDeleted(dummy, 6);
    blockOnReplication(storage, manager);
    ServerMessageImpl serverMsg = new ServerMessageImpl();
    serverMsg.setMessageID(500);
    serverMsg.setAddress(new SimpleString("tttt"));
    ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(100);
    serverMsg.encodeHeadersAndProperties(buffer);
    manager.largeMessageBegin(500);
    manager.largeMessageWrite(500, new byte[1024]);
    manager.largeMessageDelete(Long.valueOf(500));
    blockOnReplication(storage, manager);
    store.start();
    Assert.assertEquals(0, store.getNumberOfPages());
}