Search in sources :

Example 1 with ConcurrentParallelGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor in project geode by apache.

the class ConcurrentParallelGatewaySenderDUnitTest method setTestHook.

public static void setTestHook(String senderId, boolean hook) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = s;
            break;
        }
    }
    ConcurrentParallelGatewaySenderEventProcessor cProc = (ConcurrentParallelGatewaySenderEventProcessor) ((AbstractGatewaySender) sender).getEventProcessor();
    if (cProc == null)
        return;
    cProc.TEST_HOOK = hook;
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) ConcurrentParallelGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor)

Example 2 with ConcurrentParallelGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor in project geode by apache.

the class ParallelAsyncEventQueueImpl method start.

@Override
public void start() {
    this.getLifeCycleLock().writeLock().lock();
    try {
        if (isRunning()) {
            logger.warn(LocalizedMessage.create(LocalizedStrings.GatewaySender_SENDER_0_IS_ALREADY_RUNNING, this.getId()));
            return;
        }
        if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
            String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
            if (locators.length() == 0) {
                throw new IllegalStateException(LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER.toLocalizedString());
            }
        }
        /*
       * Now onwards all processing will happen through
       * "ConcurrentParallelGatewaySenderEventProcessor" we have made
       * "ParallelGatewaySenderEventProcessor" and "ParallelGatewaySenderQueue" as a utility classes
       * of Concurrent version of processor and queue.
       */
        eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this);
        eventProcessor.start();
        waitForRunningStatus();
        // Only notify the type registry if this is a WAN gateway queue
        if (!isAsyncEventQueue()) {
            getCache().getPdxRegistry().gatewaySenderStarted(this);
        }
        new UpdateAttributesProcessor(this).distribute(false);
        InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem();
        system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
        logger.info(LocalizedMessage.create(LocalizedStrings.ParallelGatewaySenderImpl_STARTED__0, this));
        enqueueTempEvents();
    } finally {
        this.getLifeCycleLock().writeLock().unlock();
    }
}
Also used : UpdateAttributesProcessor(org.apache.geode.internal.cache.UpdateAttributesProcessor) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) ConcurrentParallelGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor)

Example 3 with ConcurrentParallelGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor in project geode by apache.

the class WANTestBase method verifyAndGetEventsDispatchedByConcurrentDispatchers.

public static int verifyAndGetEventsDispatchedByConcurrentDispatchers(final String senderId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = s;
            break;
        }
    }
    ConcurrentParallelGatewaySenderEventProcessor cProc = (ConcurrentParallelGatewaySenderEventProcessor) ((AbstractGatewaySender) sender).getEventProcessor();
    if (cProc == null)
        return 0;
    int totalDispatched = 0;
    for (ParallelGatewaySenderEventProcessor lProc : cProc.getProcessors()) {
        totalDispatched += lProc.getNumEventsDispatched();
    }
    assertTrue(totalDispatched > 0);
    return totalDispatched;
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) ConcurrentParallelGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor) ConcurrentParallelGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor) ParallelGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor)

Aggregations

ConcurrentParallelGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor)3 GatewaySender (org.apache.geode.cache.wan.GatewaySender)2 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 UpdateAttributesProcessor (org.apache.geode.internal.cache.UpdateAttributesProcessor)1 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)1 ParallelGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderEventProcessor)1