use of org.apache.geode.internal.cache.ha.HARegionQueueStats in project geode by apache.
the class DurableClientSimpleDUnitTest method waitForEventsRemovedByQueueRemovalMessage.
private static void waitForEventsRemovedByQueueRemovalMessage(String durableClientId, final int numEvents) {
CacheClientNotifier ccn = CacheClientNotifier.getInstance();
CacheClientProxy ccp = ccn.getClientProxy(durableClientId);
HARegionQueue harq = ccp.getHARegionQueue();
HARegionQueueStats harqStats = harq.getStatistics();
Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> assertEquals("Expected queue removal messages: " + numEvents + " but actual messages: " + harqStats.getEventsRemovedByQrm(), numEvents, harqStats.getEventsRemovedByQrm()));
}
use of org.apache.geode.internal.cache.ha.HARegionQueueStats in project geode by apache.
the class Bug47388DUnitTest method verifyClientSubscriptionStats.
public static void verifyClientSubscriptionStats(final Boolean isPrimary, final Integer events) throws Exception {
WaitCriterion wc = new WaitCriterion() {
private long dispatched;
private long qrmed;
@Override
public boolean done() {
HARegionQueueStats stats = ((CacheClientProxy) CacheClientNotifier.getInstance().getClientProxies().toArray()[0]).getHARegionQueue().getStatistics();
final int numOfEvents;
if (!isPrimary) {
// No marker
numOfEvents = events - 1;
} else {
numOfEvents = events;
}
if (isPrimary) {
this.dispatched = stats.getEventsDispatched();
return numOfEvents == this.dispatched;
} else {
this.qrmed = stats.getEventsRemovedByQrm();
return this.qrmed == numOfEvents || (this.qrmed + 1) == numOfEvents;
// Why +1 above? Because sometimes(TODO: explain further) there may
// not be any QRM sent to the secondary for the last event dispatched
// at primary.
}
}
@Override
public String description() {
return "Expected events: " + events + " but actual eventsDispatched: " + this.dispatched + " and actual eventsRemovedByQrm: " + this.qrmed;
}
};
Wait.waitForCriterion(wc, 60 * 1000, 500, true);
}
Aggregations