Search in sources :

Example 1 with ConcurrentSerialGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor in project geode by apache.

the class WANTestBase method stopSender.

public static void stopSender(String senderId) {
    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
    IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
    try {
        Set<GatewaySender> senders = cache.getGatewaySenders();
        GatewaySender sender = null;
        for (GatewaySender s : senders) {
            if (s.getId().equals(senderId)) {
                sender = s;
                break;
            }
        }
        AbstractGatewaySenderEventProcessor eventProcessor = null;
        if (sender instanceof AbstractGatewaySender) {
            eventProcessor = ((AbstractGatewaySender) sender).getEventProcessor();
        }
        sender.stop();
        Set<RegionQueue> queues = null;
        if (eventProcessor instanceof ConcurrentSerialGatewaySenderEventProcessor) {
            queues = ((ConcurrentSerialGatewaySenderEventProcessor) eventProcessor).getQueues();
            for (RegionQueue queue : queues) {
                if (queue instanceof SerialGatewaySenderQueue) {
                    assertFalse(((SerialGatewaySenderQueue) queue).isRemovalThreadAlive());
                }
            }
        }
    } finally {
        exp.remove();
        exln.remove();
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) SerialGatewaySenderQueue(org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderQueue) IgnoredException(org.apache.geode.test.dunit.IgnoredException) ConcurrentSerialGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Example 2 with ConcurrentSerialGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor in project geode by apache.

the class SerialAsyncEventQueueImpl method start.

@Override
public void start() {
    if (logger.isDebugEnabled()) {
        logger.debug("Starting gatewaySender : {}", this);
    }
    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 GatewaySenderConfigurationException(LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER.toLocalizedString());
            }
        }
        getSenderAdvisor().initDLockService();
        if (!isPrimary()) {
            if (getSenderAdvisor().volunteerForPrimary()) {
                getSenderAdvisor().makePrimary();
            } else {
                getSenderAdvisor().makeSecondary();
            }
        }
        if (getDispatcherThreads() > 1) {
            eventProcessor = new ConcurrentSerialGatewaySenderEventProcessor(SerialAsyncEventQueueImpl.this);
        } else {
            eventProcessor = new SerialGatewaySenderEventProcessor(SerialAsyncEventQueueImpl.this, getId());
        }
        eventProcessor.start();
        waitForRunningStatus();
        this.startTime = System.currentTimeMillis();
        // 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.SerialGatewaySenderImpl_STARTED__0, this));
        enqueueTempEvents();
    } finally {
        this.getLifeCycleLock().writeLock().unlock();
    }
}
Also used : GatewaySenderConfigurationException(org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException) UpdateAttributesProcessor(org.apache.geode.internal.cache.UpdateAttributesProcessor) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) ConcurrentSerialGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor) ConcurrentSerialGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor) SerialGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderEventProcessor)

Example 3 with ConcurrentSerialGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor in project geode by apache.

the class AsyncEventQueueImpl method size.

@Override
public int size() {
    AbstractGatewaySenderEventProcessor eventProcessor = ((AbstractGatewaySender) sender).getEventProcessor();
    int size = 0;
    if (eventProcessor instanceof ConcurrentSerialGatewaySenderEventProcessor) {
        Set<RegionQueue> queues = ((ConcurrentSerialGatewaySenderEventProcessor) eventProcessor).getQueues();
        Iterator<RegionQueue> itr = queues.iterator();
        while (itr.hasNext()) {
            size = size + itr.next().size();
        }
    } else {
        size = eventProcessor.getQueue().size();
    }
    return size;
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) ConcurrentSerialGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor) AbstractGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Aggregations

ConcurrentSerialGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor)3 RegionQueue (org.apache.geode.internal.cache.RegionQueue)2 GatewaySender (org.apache.geode.cache.wan.GatewaySender)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)1 UpdateAttributesProcessor (org.apache.geode.internal.cache.UpdateAttributesProcessor)1 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)1 AbstractGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor)1 GatewaySenderConfigurationException (org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException)1 SerialGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderEventProcessor)1 SerialGatewaySenderQueue (org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderQueue)1 IgnoredException (org.apache.geode.test.dunit.IgnoredException)1