use of org.apache.geode.internal.cache.CacheDistributionAdvisor in project geode by apache.
the class CacheClientNotifier method blackListSlowReciever.
private void blackListSlowReciever(CacheClientProxy clientProxy) {
final CacheClientProxy proxy = clientProxy;
if ((proxy.getHARegionQueue() != null && proxy.getHARegionQueue().isClientSlowReciever()) && !blackListedClients.contains(proxy.getProxyID())) {
// log alert with client info.
logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_CLIENT_0_IS_A_SLOW_RECEIVER, new Object[] { proxy.getProxyID() }));
addToBlacklistedClient(proxy.getProxyID());
InternalDistributedSystem ids = (InternalDistributedSystem) this.getCache().getDistributedSystem();
final DM dm = ids.getDistributionManager();
dm.getWaitingThreadPool().execute(new Runnable() {
public void run() {
CacheDistributionAdvisor advisor = ((DistributedRegion) proxy.getHARegionQueue().getRegion()).getCacheDistributionAdvisor();
Set members = advisor.adviseCacheOp();
// Send client blacklist message
ClientBlacklistProcessor.sendBlacklistedClient(proxy.getProxyID(), dm, members);
// close the proxy for slow receiver.
proxy.close(false, false);
removeClientProxy(proxy);
if (PoolImpl.AFTER_QUEUE_DESTROY_MESSAGE_FLAG) {
ClientServerObserver bo = ClientServerObserverHolder.getInstance();
bo.afterQueueDestroyMessage();
}
// send remove from blacklist.
RemoveClientFromBlacklistMessage rcm = new RemoveClientFromBlacklistMessage();
rcm.setProxyID(proxy.getProxyID());
dm.putOutgoing(rcm);
blackListedClients.remove(proxy.getProxyID());
}
});
}
}
Aggregations