/** * Closes the proxy. This method checks the message queue for any unprocessed * messages and processes them for MAXIMUM_SHUTDOWN_PEEKS. * * @see CacheClientProxy#MAXIMUM_SHUTDOWN_PEEKS */ protected void close() { close(true, false); }
public void run2() throws CacheException { // Find the proxy checkNumberOfClientProxies(1); CacheClientProxy proxy = getClientProxy(); assertNotNull(proxy); // Verify that it is durable and its properties are correct assertTrue(proxy.isDurable()); assertEquals(durableClientId, proxy.getDurableId()); assertEquals(durableClientTimeout, proxy.getDurableTimeout()); } });
public void run2() throws CacheException { // Get the CacheClientNotifier CacheClientNotifier notifier = getBridgeServer().getAcceptor() .getCacheClientNotifier(); // Iterate the CacheClientProxies checkNumberOfClientProxies(2); String firstProxyRegionName = null; for (Iterator i = notifier.getClientProxies().iterator(); i.hasNext();) { CacheClientProxy proxy = (CacheClientProxy) i.next(); assertTrue(proxy.isDurable()); assertEquals(durableClientId, proxy.getDurableId()); assertEquals(DistributionConfig.DEFAULT_DURABLE_CLIENT_TIMEOUT, proxy.getDurableTimeout()); // Verify the two HA region names aren't the same if (firstProxyRegionName == null) { firstProxyRegionName = proxy.getHARegionName(); } else { assertTrue(!firstProxyRegionName.equals(proxy.getHARegionName())); } } } });
public static String getClientIdFromCacheClientProxy(CacheClientProxy p){ if(p == null){ return null; } StringBuffer buffer = new StringBuffer(); buffer.append("[").append(p.getProxyID()).append(":port=").append(p.getRemotePort()).append(":primary=") .append(p.isPrimary()).append("]"); return buffer.toString(); }
public static boolean checkPrimary(CacheClientProxy proxy) { Log.getLogWriter().info("proxy " + proxy.getProxyID()+ " : " + proxy.isPrimary()); return proxy.isPrimary(); }
/** * Returns (possibly stale) map of queue sizes for all clients notified * by this server. * * @return map with CacheClientProxy as key, and Integer as a value */ public Map getClientQueueSizes() { Map/*<ClientProxyMembershipID,Integer>*/ queueSizes = new HashMap(); for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) { CacheClientProxy proxy = (CacheClientProxy)iter.next(); queueSizes.put(proxy.getProxyID(), Integer.valueOf(proxy.getQueueSize())); } return queueSizes; }
l_proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation, clientVersion, acceptorId, notifyBySubscription); successful = this.initializeProxy(l_proxy); } else { if (proxy.isPrimary()) { epType = (byte) 2; } else { epType = (byte) 1; qSize = proxy.getQueueSize(); if (l_proxy.isPaused()) { if (CacheClientProxy.testHook != null) { CacheClientProxy.testHook.doTestHook("CLIENT_PRE_RECONNECT"); if (l_proxy.lockDrain()) { try { if (logger.isDebugEnabled()) { l_proxy.getProxyID().updateDurableTimeout(proxyId.getDurableTimeout()); l_proxy.reinitialize(socket, proxyId, this.getCache(), isPrimary, clientConflation, clientVersion); l_proxy.setMarkerEnqueued(true); if (CacheClientProxy.testHook != null) { CacheClientProxy.testHook.doTestHook("CLIENT_RECONNECTED"); l_proxy.unlockDrain(); if (staleClientProxy.startRemoval()) {
protected Message getGFE61Message(CacheClientProxy proxy, byte[] latestValue, boolean conflation, Version clientVersion) throws IOException { Message message = null; ClientProxyMembershipID proxyId = proxy.getProxyID(); && !proxy.isMarkerEnqueued() && !proxy.getRegionsWithEmptyDataPolicy() .containsKey(_regionName)) { message.addObjPart(Boolean.TRUE); message.addBytesPart(this.deltaBytes); proxy.getStatistics().incDeltaMessagesSent();
ClientProxyMembershipID proxyID = p.getProxyID(); if(!p.isConnected() && !proxyID.isDurable()){ return null; buffer.append("[").append(proxyID).append("; port=").append(p.getRemotePort()).append("; primary=").append( p.isPrimary()).append("]"); status.setUpTime(p.getUpTime()); status.setQueueSize(p.getQueueSizeStat()); status.setName(clientName); status.setHostName(p.getSocketHost());
((HAContainerWrapper)proxy._cacheClientNotifier.getHaContainer()) .putProxy(HARegionQueue.createRegionName(getProxy() .getHARegionName()), getProxy()); boolean createDurableQueue = proxy.proxyID.isDurable(); boolean canHandleDelta = (proxy.clientVersion.compareTo(Version.GFE_61) >= 0) getProxy().getHARegionName(), getCache(), harq, HARegionQueue.BLOCKING_HA_QUEUE, createDurableQueue, proxy._cacheClientNotifier.getHaContainer(), proxy.getProxyID(), this._proxy.clientConflation, this._proxy.isPrimary(), canHandleDelta); if (this._proxy.hasRegisteredInterested()) { this._messageQueue.setHasRegisteredInterest(true);
keepProxy = proxy.close(false, stoppedNormally); logger.info(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2, new Object[] {proxy.getDurableId(), Integer.valueOf(proxy.getDurableTimeout()), proxy})); } else { closeAllClientCqs(proxy); proxy.notifyRemoval();
if (proxy != null && proxy.waitRemoval()) { proxy = getAcceptor().getCacheClientNotifier().getClientProxy( this.proxyId); logger.debug("Proxy existed for this durable client :{} and proxy : {}", this.proxyId, proxy); if(proxy.isPrimary()){ epType = (byte)2 ; qSize = proxy.getQueueSize(); }else { epType = (byte)1; qSize = proxy.getQueueSize(); if (proxy != null && !proxy.isPaused()) {
public void run2() throws CacheException { // Find the proxy checkNumberOfClientProxies(1); CacheClientProxy proxy = getClientProxy(); assertNotNull(proxy); // Verify that it is durable assertTrue(proxy.isDurable()); assertEquals(durableClientId, proxy.getDurableId()); } });
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()); } });
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; }
public String description() { return "waiting for queues to drain for " + fproxy.getProxyID(); } };
/** * Registers interest in the input region name and list of keys * * @param regionName * The fully-qualified name of the region in which to register * interest * @param keysOfInterest * The list of keys in which to register interest */ protected void registerClientInterestList(String regionName, List keysOfInterest, boolean isDurable, boolean sendUpdatesAsInvalidates, boolean flushState) { // we only use two interest lists to map the non-durable and durable // identifiers to their interest settings ClientInterestList cil = this.cils[RegisterInterestTracker.getInterestLookupIndex( isDurable, false/*sendUpdatesAsInvalidates*/)]; cil.registerClientInterestList(regionName, keysOfInterest, sendUpdatesAsInvalidates); if (getHARegionQueue() != null) { if (flushState) { flushForInterestRegistration(regionName, this._cache.getDistributedSystem().getDistributedMember()); } getHARegionQueue().setHasRegisteredInterest(true); } }
proxy.registerClientInterest(regionName, keyOfInterest, interestType, isDurable, sendUpdatesAsInvalidates, flushState); updateMapOfEmptyRegions(proxy.getRegionsWithEmptyDataPolicy(), regionName, regionDataPolicy); proxy.unregisterClientInterest(regionName, keyOfInterest, interestType, false);
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); //Wait until we get the expected number of events or until 10 seconds are up WaitCriterion ev = new WaitCriterion() { public boolean done() { return clientProxy.getQueueSizeStat() == expectedNumber || clientProxy.getQueueSizeStat() == remaining; } public String description() { return "queue size stat was expected to be " + expectedNumber + " but was instead " + clientProxy.getQueueSizeStat(); } }; DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true); assertTrue(clientProxy.getQueueSizeStat() == expectedNumber || clientProxy.getQueueSizeStat() == remaining); } });
private void blackListSlowReciever(CacheClientProxy clientProxy){ final CacheClientProxy proxy = clientProxy; if ((proxy.getHARegionQueue() != null && proxy.getHARegionQueue().isClientSlowReciever()) && !blackListedClients.contains(proxy.getProxyID())) { 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();