@Override public ClientProxyMembershipID getProxyID(String haRegionName) { CacheClientProxy proxy = haRegionNameToProxy.get(haRegionName); if (proxy != null) { return proxy.getProxyID(); } else { return null; } }
@Override public ClientProxyMembershipID getProxyID(String haRegionName) { CacheClientProxy proxy = haRegionNameToProxy.get(haRegionName); if (proxy != null) { return proxy.getProxyID(); } else { return null; } }
protected boolean isProxyInInitializationMode(CacheClientProxy proxy) throws IOException { return this._initClientProxies.containsKey(proxy.getProxyID()); }
protected void addClientInitProxy(CacheClientProxy proxy) throws IOException { this._initClientProxies.put(proxy.getProxyID(), proxy); }
protected void removeClientInitProxy(CacheClientProxy proxy) throws IOException { this._initClientProxies.remove(proxy.getProxyID()); }
protected boolean isDurable() { return getProxyID().isDurable(); }
protected String getHARegionName() { return getProxyID().getHARegionName(); }
/** * 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; }
protected int getDurableTimeout() { return getProxyID().getDurableTimeout(); }
/** * Return (possibly stale) list of all clients and their status * * @return Map, with CacheClientProxy as a key and CacheClientStatus as a value */ public Map getAllClients() { Map clients = new HashMap(); for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) { CacheClientProxy proxy = (CacheClientProxy) iter.next(); ClientProxyMembershipID proxyID = proxy.getProxyID(); clients.put(proxyID, new CacheClientStatus(proxyID)); } return clients; }
protected String getDurableId() { return getProxyID().getDurableId(); }
private 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(); }
/** * Checks if there is any proxy present for the given durable client * * @param durableId - id for the durable-client * @return - true if a proxy is present for the given durable client * * @since GemFire 5.6 */ public boolean hasDurableClient(String durableId) { for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) { CacheClientProxy proxy = (CacheClientProxy) iter.next(); ClientProxyMembershipID proxyID = proxy.getProxyID(); if (durableId.equals(proxyID.getDurableId())) { return true; } } return false; }
/** * Returns (possibly stale) set of memberIds for all clients being actively notified by this * server. * * @return set of memberIds */ public Set getActiveClients() { Set clients = new HashSet(); for (Iterator iter = getClientProxies().iterator(); iter.hasNext();) { CacheClientProxy proxy = (CacheClientProxy) iter.next(); if (proxy.hasRegisteredInterested()) { ClientProxyMembershipID proxyID = proxy.getProxyID(); clients.add(proxyID); } } return clients; }
public static boolean checkPrimary(CacheClientProxy proxy) { System.out.println("proxy " + proxy.getProxyID() + " : " + proxy.isPrimary()); return proxy.isPrimary(); }
/** * this method uses CacheClientNotifier to try to obtain an ID that is equal to this one. This is * used during deserialization to reduce storage overhead. */ private ClientProxyMembershipID canonicalReference() { CacheClientNotifier ccn = CacheClientNotifier.getInstance(); if (ccn != null) { CacheClientProxy cp = ccn.getClientProxy(this, true); if (cp != null) { if (this.isCanonicalEquals(cp.getProxyID())) { return cp.getProxyID(); } } } return this; }
private void closeAllClientCqs(CacheClientProxy proxy) { CqService cqService = proxy.getCache().getCqService(); if (cqService != null) { final boolean isDebugEnabled = logger.isDebugEnabled(); // LocalizedMessage.create( try { if (isDebugEnabled) { logger.debug("CacheClientNotifier: Closing client CQs: {}", proxy); } cqService.closeClientCqs(proxy.getProxyID()); } catch (CqException e1) { logger.warn("Unable to close CQs for the client: {}", proxy.getProxyID()); if (isDebugEnabled) { e1.printStackTrace(); } } } }
@Override protected Message getMessage(CacheClientProxy proxy, byte[] latestValue) throws IOException { Version clientVersion = proxy.getVersion(); Message message = null; if (clientVersion.compareTo(Version.GFE_57) >= 0) { message = getGFEMessage(proxy.getProxyID(), null, clientVersion); } else { throw new IOException( "Unsupported client version for server-to-client message creation: " + clientVersion); } return message; }
private void closeNonDurableCqs() { CqService cqService = getCache().getCqService(); if (cqService != null) { try { cqService.closeNonDurableClientCqs(getProxyID()); } catch (CqException ex) { logger.warn("CqException while closing non durable Cqs. {}", ex.getLocalizedMessage()); } } }
/** * Removes an existing <code>CacheClientProxy</code> from the list of known client proxies * * @param proxy The <code>CacheClientProxy</code> to remove */ protected void removeClientProxy(CacheClientProxy proxy) { // this._logger.info(String.format("%s", "removing client proxy " + proxy, new // Exception("stack trace"))); ClientProxyMembershipID client = proxy.getProxyID(); this._clientProxies.remove(client); this._connectionListener.queueRemoved(); this.getCache().cleanupForClient(this, client); if (!(proxy.clientConflation == Handshake.CONFLATION_ON)) { ClientHealthMonitor chm = ClientHealthMonitor.getInstance(); if (chm != null) { chm.numOfClientsPerVersion.decrementAndGet(proxy.getVersion().ordinal()); } } }