Search in sources :

Example 1 with ClientQueueDetail

use of org.apache.geode.management.ClientQueueDetail in project geode by apache.

the class CacheServerBridge method getClientQueueDetails.

/**
   * @return Client Queue Details for all clients
   */
public ClientQueueDetail[] getClientQueueDetails() throws Exception {
    List<ClientQueueDetail> clientQueueDetailList = null;
    try {
        if (acceptor != null && acceptor.getCacheClientNotifier() != null) {
            Collection<CacheClientProxy> clientProxies = acceptor.getCacheClientNotifier().getClientProxies();
            if (clientProxies.size() > 0) {
                clientQueueDetailList = new ArrayList<ClientQueueDetail>();
            } else {
                return new ClientQueueDetail[0];
            }
            for (CacheClientProxy p : clientProxies) {
                ClientQueueDetail status = getClientQueueDetail(p);
                if (status != null) {
                    clientQueueDetailList.add(status);
                }
            }
            ClientQueueDetail[] queueDetailArr = new ClientQueueDetail[clientQueueDetailList.size()];
            return clientQueueDetailList.toArray(queueDetailArr);
        }
        return new ClientQueueDetail[0];
    } catch (Exception e) {
        throw new Exception(e.getMessage());
    }
}
Also used : CacheClientProxy(org.apache.geode.internal.cache.tier.sockets.CacheClientProxy) ClientQueueDetail(org.apache.geode.management.ClientQueueDetail) PidUnavailableException(org.apache.geode.internal.process.PidUnavailableException) CqException(org.apache.geode.cache.query.CqException) CqClosedException(org.apache.geode.cache.query.CqClosedException)

Example 2 with ClientQueueDetail

use of org.apache.geode.management.ClientQueueDetail 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)

Aggregations

ClientQueueDetail (org.apache.geode.management.ClientQueueDetail)2 CqClosedException (org.apache.geode.cache.query.CqClosedException)1 CqException (org.apache.geode.cache.query.CqException)1 HARegionQueue (org.apache.geode.internal.cache.ha.HARegionQueue)1 CacheClientProxy (org.apache.geode.internal.cache.tier.sockets.CacheClientProxy)1 ClientProxyMembershipID (org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID)1 PidUnavailableException (org.apache.geode.internal.process.PidUnavailableException)1