Search in sources :

Example 1 with ParallelGatewaySenderQueue

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;
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) ConcurrentParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue) ConcurrentParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue) ParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Aggregations

GatewaySender (org.apache.geode.cache.wan.GatewaySender)1 RegionQueue (org.apache.geode.internal.cache.RegionQueue)1 ConcurrentParallelGatewaySenderQueue (org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue)1 ParallelGatewaySenderQueue (org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue)1