use of org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor in project geode by apache.
the class InternalClientMembership method getConnectedClients.
/**
* Returns a map of client memberIds to count of connections to that client. The map entry key is
* a String representation of the client memberId, and the map entry value is an Integer count of
* connections to that client. Since a single client can have multiple ConnectionProxy objects,
* this map will contain all the Connection objects across the ConnectionProxies
*
* @param onlyClientsNotifiedByThisServer true will return only those clients that are actively
* being updated by this server
* @return map of client memberIds to count of connections to that client
*
*
*/
public static Map getConnectedClients(boolean onlyClientsNotifiedByThisServer) {
ClientHealthMonitor chMon = ClientHealthMonitor.getInstance();
Set filterProxyIDs = null;
if (onlyClientsNotifiedByThisServer) {
// since this is only a status (snapshot) of the system.
for (Iterator bsii = CacheFactory.getAnyInstance().getCacheServers().iterator(); bsii.hasNext(); ) {
CacheServerImpl bsi = (CacheServerImpl) bsii.next();
AcceptorImpl ai = bsi.getAcceptor();
if (ai != null && ai.getCacheClientNotifier() != null) {
if (filterProxyIDs != null) {
// notifierClients is a copy set from CacheClientNotifier
filterProxyIDs.addAll(ai.getCacheClientNotifier().getActiveClients());
} else {
// notifierClients is a copy set from CacheClientNotifier
filterProxyIDs = ai.getCacheClientNotifier().getActiveClients();
}
}
}
}
Map map = chMon.getConnectedClients(filterProxyIDs);
/*
* if (onlyClientsNotifiedByThisServer) { Map notifyMap = new HashMap();
*
* for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { String memberId = (String)
* iter.next(); if (notifierClients.contains(memberId)) { // found memberId that is notified by
* this server notifyMap.put(memberId, map.get(memberId)); } } map = notifyMap; }
*/
return map;
}
use of org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor in project geode by apache.
the class InternalClientMembership method getConnectedIncomingGateways.
public static Map getConnectedIncomingGateways() {
Map connectedIncomingGateways = null;
ClientHealthMonitor chMon = ClientHealthMonitor.getInstance();
if (chMon == null) {
connectedIncomingGateways = new HashMap();
} else {
connectedIncomingGateways = chMon.getConnectedIncomingGateways();
}
return connectedIncomingGateways;
}
Aggregations