public String getState() { StringBuffer buffer = new StringBuffer(); buffer.append("CacheClientProxy[") .append(this.proxyID) .append("; port=").append(this._socket.getPort()).append("; primary=").append(isPrimary) .append("; version=").append(clientVersion).append("; paused=").append(isPaused()) .append("; alive=").append(isAlive()).append("; connected=").append(isConnected()) .append("; isMarkedForRemoval=").append(isMarkedForRemoval).append("]"); if (_messageDispatcher != null && isAlive()) { buffer.append(LogWriterImpl.getStackTrace(_messageDispatcher)); } return buffer.toString(); }
/** * Shuts down durable client proxy */ public boolean closeDurableClientProxy(String durableClientId) throws CacheException { CacheClientProxy ccp = getClientProxy(durableClientId); if (ccp == null) { return false; } // we can probably remove the isPaused check if (ccp.isPaused() && !ccp.isConnected()) { ccp.setKeepAlive(false); closeDeadProxies(Collections.singletonList(ccp), true); return true; } else { if (logger.isDebugEnabled()) { logger.debug("Cannot close running durable client: {}", durableClientId); } // TODO: never throw an anonymous inner class throw new CacheException("Cannot close a running durable client : " + durableClientId) {}; } }
public void waitTillCacheClientProxyHasBeenPaused() { await().until(() -> { CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance(); Collection<CacheClientProxy> clientProxies = clientNotifier.getClientProxies(); for (CacheClientProxy clientProxy : clientProxies) { if (clientProxy.isPaused()) { return true; } } return false; }); }
/** * Add the input client message to the message queue * * @param clientMessage The <code>Conflatable</code> to add to the queue */ protected void enqueueMessage(Conflatable clientMessage) { try { this._messageQueue.put(clientMessage); if (this._proxy.isPaused() && this._proxy.isDurable()) { this._proxy._cacheClientNotifier.statistics.incEventEnqueuedWhileClientAwayCount(); if (logger.isDebugEnabled()) { logger.debug("{}: Queued message while Durable Client is away {}", this, clientMessage); } } } catch (CancelException e) { throw e; } catch (Exception e) { if (!isStopped()) { this._proxy._statistics.incMessagesFailedQueued(); logger.fatal( String.format("%s: Exception occurred while attempting to add message to queue", this), e); } } }
if (!this._proxy.isPaused()) { sendMessage(message);
private void sendMessageDirectly(ClientMessage clientMessage) { Message message; try { if (logger.isDebugEnabled()) { logger.debug("{}: Dispatching directly: {}", this, clientMessage); } message = clientMessage.getMessage(getProxy(), true); sendMessage(message); if (logger.isDebugEnabled()) { logger.debug("{}: Dispatched directly: {}", this, clientMessage); } // The exception handling code was modeled after the MessageDispatcher // run method } catch (MessageTooLargeException e) { logger.warn("Message too large to send to client: {}, {}", clientMessage, e.getMessage()); } catch (IOException e) { synchronized (this._stopDispatchingLock) { // Pause or unregister proxy if (!isStopped() && !getProxy().isPaused()) { logger.fatal(String.format("%s : An unexpected Exception occurred", this), e); pauseOrUnregisterProxy(e); } } } catch (Exception e) { if (!isStopped()) { logger.fatal(String.format("%s : An unexpected Exception occurred", this), e); } } }
if (this.isPaused()) {
if (l_proxy.isPaused()) { if (CacheClientProxy.testHook != null) { CacheClientProxy.testHook.doTestHook("CLIENT_PRE_RECONNECT");
if (isPaused() && !isConnected()) { CqService cqService = getCache().getCqService(); if (cqService != null) {
private void singletonRouteClientMessage(Conflatable conflatable, Collection<ClientProxyMembershipID> filterClients) { this.cache.getCancelCriterion().checkCancelInProgress(null); // bug #43942 - client notified // but no p2p distribution List<CacheClientProxy> deadProxies = null; for (ClientProxyMembershipID clientId : filterClients) { CacheClientProxy proxy; proxy = this.getClientProxy(clientId, true); if (proxy != null) { if (proxy.isAlive() || proxy.isPaused() || proxy.isConnected() || proxy.isDurable()) { proxy.deliverMessage(conflatable); } else { proxy.getStatistics().incMessagesFailedQueued(); if (deadProxies == null) { deadProxies = new ArrayList<CacheClientProxy>(); } deadProxies.add(proxy); } this.denyListSlowReceiver(proxy); } } if (conflatable instanceof HAEventWrapper) { ((HAEventWrapper) conflatable).decrementPutInProgressCounter(); } // Remove any dead clients from the clients to notify if (deadProxies != null) { closeDeadProxies(deadProxies, false); } }
if (proxy != null && !proxy.isPaused()) {