Search in sources :

Example 6 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class CacheServerBridge method getClientQueueDetail.

private ClientQueueDetail getClientQueueDetail(CacheClientProxy p) {
    ClientQueueDetail queueDetail = new ClientQueueDetail();
    ClientProxyMembershipID proxyID = p.getProxyID();
    if (!p.isConnected() && !proxyID.isDurable()) {
        return null;
    }
    queueDetail.setClientId(CliUtil.getClientIdFromCacheClientProxy(p));
    HARegionQueue queue = p.getHARegionQueue();
    if (queue == null) {
        return queueDetail;
    }
    queueDetail.setQueueSize(p.getQueueSizeStat());
    queueDetail.setEventsConflated(queue.getStatistics().getEventsConflated());
    queueDetail.setEventsEnqued(queue.getStatistics().getEventsEnqued());
    queueDetail.setEventsExpired(queue.getStatistics().getEventsExpired());
    queueDetail.setEventsRemoved(queue.getStatistics().getEventsRemoved());
    queueDetail.setEventsRemovedByQrm(queue.getStatistics().getEventsRemovedByQrm());
    queueDetail.setEventsTaken(queue.getStatistics().getEventsTaken());
    queueDetail.setMarkerEventsConflated(queue.getStatistics().getMarkerEventsConflated());
    queueDetail.setNumVoidRemovals(queue.getStatistics().getNumVoidRemovals());
    return queueDetail;
}
Also used : ClientProxyMembershipID(org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID) ClientQueueDetail(org.apache.geode.management.ClientQueueDetail) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue)

Example 7 with HARegionQueue

use of org.apache.geode.internal.cache.ha.HARegionQueue in project geode by apache.

the class Bug37210DUnitTest method closeCacheClientProxyAndVerifyStats.

/**
   * Close the CacheClientProxy of the client on the server and verify that ha-stats are closed and
   * the entry for the region is removed from dispatchedMessagesMap.
   * 
   */
public static void closeCacheClientProxyAndVerifyStats() {
    assertEquals("More than one BridgeServers found ", 1, cache.getCacheServers().size());
    CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
    assertNotNull(bs);
    assertNotNull(bs.getAcceptor());
    assertNotNull(bs.getAcceptor().getCacheClientNotifier());
    Iterator proxies = bs.getAcceptor().getCacheClientNotifier().getClientProxies().iterator();
    assertTrue("No proxy found", proxies.hasNext());
    CacheClientProxy proxy = (CacheClientProxy) proxies.next();
    Map dispatchedMsgMap = HARegionQueue.getDispatchedMessagesMapForTesting();
    HARegionQueue rq = proxy.getHARegionQueue();
    Object value = dispatchedMsgMap.get(rq.getRegion().getName());
    proxy.close();
    assertTrue("HARegionQueue stats were not closed on proxy.close()", rq.getStatistics().isClosed());
}
Also used : Iterator(java.util.Iterator) CacheServerImpl(org.apache.geode.internal.cache.CacheServerImpl) HARegionQueue(org.apache.geode.internal.cache.ha.HARegionQueue) Map(java.util.Map)

Aggregations

HARegionQueue (org.apache.geode.internal.cache.ha.HARegionQueue)7 Iterator (java.util.Iterator)2 CacheServerImpl (org.apache.geode.internal.cache.CacheServerImpl)2 IOException (java.io.IOException)1 SocketException (java.net.SocketException)1 Map (java.util.Map)1 CancelException (org.apache.geode.CancelException)1 Cache (org.apache.geode.cache.Cache)1 CacheException (org.apache.geode.cache.CacheException)1 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)1 RegionExistsException (org.apache.geode.cache.RegionExistsException)1 CqException (org.apache.geode.cache.query.CqException)1 HARegion (org.apache.geode.internal.cache.HARegion)1 HARegionQueueStats (org.apache.geode.internal.cache.ha.HARegionQueueStats)1 ThreadIdentifier (org.apache.geode.internal.cache.ha.ThreadIdentifier)1 ClientProxyMembershipID (org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID)1 ClientQueueDetail (org.apache.geode.management.ClientQueueDetail)1