boolean isSameDSMember(ClientProxyMembershipID that) { if (that != null) { // Test whether: // - the durable ids are equal (if durable) or // - the identities are equal (if non-durable) return isDurable() ? this.getDurableId().equals(that.getDurableId()) : Arrays.equals(this.identity, that.identity); } else { return false; } }
protected String getDurableId() { return getProxyID().getDurableId(); }
private String getBaseRegionName() { String id = isDurable() ? getDurableId() : getDSMembership(); if (id.indexOf('/') >= 0) { id = id.replace('/', ':'); } StringBuffer buffer = new StringBuffer().append("_gfe_").append(isDurable() ? "" : "non_") .append("durable_client_").append("with_id_" + id).append("_").append(this.uniqueId); return buffer.toString(); }
@Override public int hashCode() { int result = 17; final int mult = 37; if (isDurable()) { result = mult * result + getDurableId().hashCode(); } else { if (this.identity != null && this.identity.length > 0) { for (int i = 0; i < this.identity.length; i++) { result = mult * result + this.identity[i]; } } } // we can't use unique_id in hashCode // because of HandShake's hashCode using our HashCode but // its equals using our isSameDSMember which ignores unique_id // result = mult * result + this.unique_id; return result; }
/** * 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; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || !(obj instanceof ClientProxyMembershipID)) { return false; } ClientProxyMembershipID that = (ClientProxyMembershipID) obj; if (this.uniqueId != that.uniqueId) { return false; } boolean isDurable = this.isDurable(); if (isDurable && !that.isDurable()) { return false; } if (isDurable) { return this.getDurableId().equals(that.getDurableId()); } return Arrays.equals(this.identity, that.identity); }
/** * @return Returns the serverCqName. */ @Override public String constructServerCqName(String cqName, ClientProxyMembershipID clientProxyId) { ConcurrentHashMap<ClientProxyMembershipID, String> cache = serverCqNameCache.computeIfAbsent(cqName, key -> new ConcurrentHashMap<>()); String cName = cache.get(clientProxyId); if (null == cName) { final StringBuilder sb = new StringBuilder(cqName).append("__"); if (clientProxyId.isDurable()) { sb.append(clientProxyId.getDurableId()); } else { sb.append(clientProxyId.getDSMembership()); } cName = sb.toString(); cache.put(clientProxyId, cName); } return cName; }
/** * Checks if there is any proxy which is primary for the given durable client * * @param durableId - id for the durable-client * @return - true if a primary proxy is present for the given durable client * * @since GemFire 5.6 */ public boolean hasPrimaryForDurableClient(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())) { if (proxy.isPrimary()) { return true; } else { return false; } } } return false; }
String.format( "CacheClientProxy: Could not drain cq %s due to client proxy id %s reconnecting.", clientCQName, proxyID.getDurableId()); logger.info(msg); throw new CqException(msg); String.format( "CacheClientProxy: Could not drain cq %s because client proxy id %s is connected.", clientCQName, proxyID.getDurableId()); logger.info(msg); throw new CqException(msg);
if (clientIsDurable) { logger.debug("CacheClientNotifier: Attempting to register durable client: {}", proxyId.getDurableId()); } else { logger.debug("CacheClientNotifier: Attempting to register non-durable client"); logger.debug( "CacheClientNotifier: No proxy exists for durable client with id {}. It must be created.", proxyId.getDurableId()); logger.debug( "CacheClientNotifier: A proxy exists for durable client with id {}. This proxy will be reinitialized: {}", proxyId.getDurableId(), l_proxy); String.format( "The requested durable client has the same identifier ( %s ) as an existing durable client ( %s ). Duplicate durable clients are not allowed.", new Object[] {proxyId.getDurableId(), proxy}); logger.warn(unsuccessfulMsg);
getInterestMaps(pf, rName, DURABLE, clientID.getDurableId());
if (clientIdFromProxy != null && clientIdFromProxy.equals(clientID)) { foundClientinCCP = true; String durableId = ccp.getProxyID().getDurableId(); boolean isPrimary = ccp.isPrimary(); clientInfo = new ClientInfo( String durableId = cliIdFrmProxy.getDurableId(); clientInfo = new ClientInfo((durableId != null && durableId.length() > 0 ? "Yes" : "No"),
proxyId.getDurableId()); logger.warn("{} : {}", new Object[] {this.name, handshakeRefusalMessage});