use of org.apache.geode.internal.cache.RegionQueue 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;
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method validateParallelSenderQueueAllBucketsDrained.
public static void validateParallelSenderQueueAllBucketsDrained(final String senderId) {
IgnoredException exp = IgnoredException.addIgnoredException(RegionDestroyedException.class.getName());
IgnoredException exp1 = 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;
}
}
RegionQueue regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
Set<BucketRegion> buckets = ((PartitionedRegion) regionQueue.getRegion()).getDataStore().getAllLocalPrimaryBucketRegions();
for (final BucketRegion bucket : buckets) {
Awaitility.await().atMost(180, TimeUnit.SECONDS).until(() -> {
assertEquals("Expected bucket entries for bucket: " + bucket.getId() + " is: 0 but actual entries: " + bucket.keySet().size() + " This bucket isPrimary: " + bucket.getBucketAdvisor().isPrimary() + " KEYSET: " + bucket.keySet(), 0, bucket.keySet().size());
});
}
// for loop ends
} finally {
exp.remove();
exp1.remove();
}
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method validateQueueContentsForConcurrentSerialGatewaySender.
public static void validateQueueContentsForConcurrentSerialGatewaySender(final String senderId, final int regionSize) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
final Set<RegionQueue> regionQueue;
if (!sender.isParallel()) {
regionQueue = ((AbstractGatewaySender) sender).getQueuesForConcurrentSerialGatewaySender();
} else {
regionQueue = null;
}
Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> {
int size = 0;
for (RegionQueue q : regionQueue) {
size += q.size();
}
assertEquals(true, regionSize == size);
});
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method getNumberOfEntriesInVM.
public static Long getNumberOfEntriesInVM(final String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
RegionQueue regionQueue;
long numEntries = 0;
if (sender.isParallel()) {
regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
numEntries = ((ConcurrentParallelGatewaySenderQueue) regionQueue).getNumEntriesInVMTestOnly();
}
return numEntries;
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method addCacheQueueListener.
private void addCacheQueueListener(String senderId, boolean isParallel) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
listener1 = new QueueListener();
if (!isParallel) {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
for (RegionQueue q : queues) {
q.addCacheListener(listener1);
}
} else {
RegionQueue parallelQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
parallelQueue.addCacheListener(listener1);
}
}
Aggregations