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