use of org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue 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;
}
Aggregations