Search in sources :

Example 21 with Page

use of org.apache.activemq.artemis.core.paging.impl.Page in project activemq-artemis by apache.

the class ReplicationEndpoint method handlePageWrite.

/**
 * @param packet
 */
private void handlePageWrite(final ReplicationPageWriteMessage packet) throws Exception {
    PagedMessage pgdMessage = packet.getPagedMessage();
    pgdMessage.initMessage(storageManager);
    Message msg = pgdMessage.getMessage();
    Page page = getPage(msg.getAddressSimpleString(), packet.getPageNumber());
    page.write(pgdMessage);
}
Also used : PagedMessage(org.apache.activemq.artemis.core.paging.PagedMessage) ReplicationResponseMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessage) ReplicationAddMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddMessage) ReplicationStartSyncMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationStartSyncMessage) ReplicationLargeMessageBeginMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage) ReplicationLargeMessageEndMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage) ReplicationPageEventMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage) ReplicationCommitMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationCommitMessage) ReplicationPrepareMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage) ActiveMQExceptionMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage) BackupReplicationStartFailedMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupReplicationStartFailedMessage) ReplicationLargeMessageWriteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage) ReplicationPageWriteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage) ReplicationLiveIsStoppingMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage) PagedMessage(org.apache.activemq.artemis.core.paging.PagedMessage) ReplicationDeleteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationDeleteMessage) ReplicationSyncFileMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationSyncFileMessage) ReplicationAddTXMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddTXMessage) ReplicationDeleteTXMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage) Message(org.apache.activemq.artemis.api.core.Message) Page(org.apache.activemq.artemis.core.paging.impl.Page)

Example 22 with Page

use of org.apache.activemq.artemis.core.paging.impl.Page in project activemq-artemis by apache.

the class ReplicationEndpoint method handlePageEvent.

/**
 * @param packet
 */
private void handlePageEvent(final ReplicationPageEventMessage packet) throws Exception {
    ConcurrentMap<Integer, Page> pages = getPageMap(packet.getStoreName());
    Page page = pages.remove(packet.getPageNumber());
    if (page == null) {
        page = getPage(packet.getStoreName(), packet.getPageNumber());
    }
    if (page != null) {
        if (packet.isDelete()) {
            if (deletePages) {
                page.delete(null);
            }
        } else {
            page.close(false);
        }
    }
}
Also used : Page(org.apache.activemq.artemis.core.paging.impl.Page)

Aggregations

Page (org.apache.activemq.artemis.core.paging.impl.Page)22 PagedMessage (org.apache.activemq.artemis.core.paging.PagedMessage)13 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)10 ArrayList (java.util.ArrayList)8 PagingStore (org.apache.activemq.artemis.core.paging.PagingStore)6 NullStorageManager (org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager)6 Message (org.apache.activemq.artemis.api.core.Message)5 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)5 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)4 PagingStoreFactory (org.apache.activemq.artemis.core.paging.PagingStoreFactory)4 NonExistentPage (org.apache.activemq.artemis.core.paging.cursor.NonExistentPage)4 PagingStoreImpl (org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl)4 RoutingContextImpl (org.apache.activemq.artemis.core.server.impl.RoutingContextImpl)4 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)4 Test (org.junit.Test)4 File (java.io.File)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)3