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();
}
}
Aggregations