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; } }
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(); }
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(); }
private String getBaseRegionName() { String id = isDurable()? getDurableId() : getDSMembership(); if (id.indexOf('/') >= 0) { id = id.replace('/', ':'); } StringBuilder buffer = new StringBuilder() .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; }
@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); }
/** * 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 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; }
/** * 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 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 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; }
@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. */ public String constructServerCqName(String cqName, ClientProxyMembershipID clientProxyId) { String cName = null; if (clientProxyId.isDurable()) { cName = cqName + "__" + clientProxyId.getDurableId(); } else { cName = cqName + "__" + clientProxyId.getDSMembership(); } 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 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; }
/** * 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 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; }
public void run2() throws CacheException { final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); fail("expected a cq exception. We have an active client proxy, the close cq command should have failed"); } catch (CqException e) { //expected exception; String expected = LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_ACTIVE_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()); if (!e.getMessage().equals(expected)) { fail("Not the expected exception, was expecting " + (LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_ACTIVE_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()) + " instead of exception: " + e.getMessage())); } } } });
public void run2() throws CacheException { //Set the Test Hook! //This test hook will pause during the drain process CacheClientProxy.testHook = new CqExceptionDueToActivatingClientTestHook(); final CacheClientNotifier ccnInstance = CacheClientNotifier .getInstance(); final CacheClientProxy clientProxy = ccnInstance .getClientProxy(durableClientId); ClientProxyMembershipID proxyId = clientProxy.getProxyID(); try { ccnInstance.closeClientCq(durableClientId, "All"); fail("Should have thrown an exception due to activating client"); } catch (CqException e) { String expected = LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_RESTARTING_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()); if (!e.getMessage().equals(expected)) { fail("Not the expected exception, was expecting " + (LocalizedStrings.CacheClientProxy_COULD_NOT_DRAIN_CQ_DUE_TO_RESTARTING_DURABLE_CLIENT.toLocalizedString("All", proxyId.getDurableId()) + " instead of exception: " + e.getMessage())); } } } });
Set intrests = Collections.EMPTY_SET; Set interestKeys = pf.getKeysOfInterest(p.getProxyID().getDurableId()); assertNotNull("durable Interests not found for the proxy", interestKeys); assertEquals("The number of durable keys registered during HARegion GII doesn't match.", interestKeys.size(), 2);
Set intrests = Collections.EMPTY_SET; Set interestKeys = pf.getKeysOfInterest(p.getProxyID().getDurableId()); assertNotNull("durable Interests not found for the proxy", interestKeys); assertEquals("The number of durable keys registered during HARegion GII doesn't match.", interestKeys.size(), 2);
if(clientIdFromProxy != null && clientIdFromProxy.equals(clientID)){ foundClientinCCP = true; String durableId = ccp.getProxyID().getDurableId(); boolean isPrimary = ccp.isPrimary(); clientInfo = new ClientInfo((durableId != null && durableId.length() > 0 ? "Yes" : "No"), String durableId = cliIdFrmProxy.getDurableId(); clientInfo = new ClientInfo((durableId != null && durableId.length() > 0 ? "Yes" : "No"), "N.A." , "N.A." );