Search in sources :

Example 1 with SerialGatewaySenderEventProcessor

use of org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderEventProcessor 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)

Aggregations

InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 UpdateAttributesProcessor (org.apache.geode.internal.cache.UpdateAttributesProcessor)1 GatewaySenderConfigurationException (org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException)1 ConcurrentSerialGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.serial.ConcurrentSerialGatewaySenderEventProcessor)1 SerialGatewaySenderEventProcessor (org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderEventProcessor)1