use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class WANTestBase method waitForAsyncQueueToGetEmpty.
public static void waitForAsyncQueueToGetEmpty(String asyncQueueId) {
AsyncEventQueue theAsyncEventQueue = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncQueueId.equals(asyncChannel.getId())) {
theAsyncEventQueue = asyncChannel;
}
}
final GatewaySender sender = ((AsyncEventQueueImpl) theAsyncEventQueue).getSender();
if (sender.isParallel()) {
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
});
} else {
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
});
}
}
Aggregations