use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method getNumberOfEntriesOverflownToDisk.
public static Long getNumberOfEntriesOverflownToDisk(final String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
long numEntries = 0;
if (sender.isParallel()) {
RegionQueue regionQueue;
regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
numEntries = ((ConcurrentParallelGatewaySenderQueue) regionQueue).getNumEntriesOverflowOnDiskTestOnly();
}
return numEntries;
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method verifyQueueSize.
public static void verifyQueueSize(String senderId, int size) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
if (!sender.isParallel()) {
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int queueSize = 0;
for (RegionQueue q : queues) {
queueSize += q.size();
}
assertEquals("verifyQueueSize failed for sender " + senderId, size, queueSize);
} else if (sender.isParallel()) {
RegionQueue regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
assertEquals("verifyQueueSize failed for sender " + senderId, size, regionQueue.size());
}
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method getQueueContentSize.
public static Integer getQueueContentSize(final String senderId, boolean includeSecondary) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
if (!sender.isParallel()) {
if (includeSecondary) {
fail("Not implemented yet");
}
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
return size;
} else if (sender.isParallel()) {
RegionQueue regionQueue = null;
regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
if (regionQueue instanceof ConcurrentParallelGatewaySenderQueue) {
return ((ConcurrentParallelGatewaySenderQueue) regionQueue).localSize(includeSecondary);
} else if (regionQueue instanceof ParallelGatewaySenderQueue) {
return ((ParallelGatewaySenderQueue) regionQueue).localSize(includeSecondary);
} else {
if (includeSecondary) {
fail("Not Implemented yet");
}
regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
return regionQueue.getRegion().size();
}
}
fail("Not yet implemented?");
return 0;
}
use of org.apache.geode.internal.cache.RegionQueue 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.RegionQueue in project geode by apache.
the class WANTestBase method getSenderStats.
public static List<Integer> getSenderStats(String senderId, final int expectedQueueSize) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
final GatewaySenderStats statistics = sender.getStatistics();
if (expectedQueueSize != -1) {
final RegionQueue regionQueue;
regionQueue = sender.getQueues().toArray(new RegionQueue[1])[0];
Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> assertEquals("Expected queue entries: " + expectedQueueSize + " but actual entries: " + regionQueue.size(), expectedQueueSize, regionQueue.size()));
}
ArrayList<Integer> stats = new ArrayList<Integer>();
stats.add(statistics.getEventQueueSize());
stats.add(statistics.getEventsReceived());
stats.add(statistics.getEventsQueued());
stats.add(statistics.getEventsDistributed());
stats.add(statistics.getBatchesDistributed());
stats.add(statistics.getBatchesRedistributed());
stats.add(statistics.getEventsFiltered());
stats.add(statistics.getEventsNotQueuedConflated());
stats.add(statistics.getEventsConflatedFromBatches());
return stats;
}
Aggregations