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