public static ClientProxyMembershipID getClientId(DistributedMember member) { return new ClientProxyMembershipID(member); }
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; } }
@Override public String toString() { return this.id.toString() + ",Principal:" + (this.principal == null ? "" : this.principal.getName()); }
/** method to obtain ClientProxyMembership for client side */ public static synchronized ClientProxyMembershipID getNewProxyMembership( DistributedSystem sys) { initializeAndGetDSIdentity(sys); return new ClientProxyMembershipID(++synch_counter); }
/** * @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; }
@Override public String toString() { if (this.identity != null && ((InternalDistributedMember)getDistributedMember()).getPort() == 0) { return this.toStringNoCache(); } if (this._toString == null) { this._toString = this.toStringNoCache(); } return this._toString; }
private void doServerLocation() throws Exception { { ClientConnectionRequest request = new ClientConnectionRequest(Collections.EMPTY_SET, "group1"); ClientConnectionResponse response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress.getLocalHost(), port, request, REQUEST_TIMEOUT); Assert.assertEquals(null, response.getServer()); } { QueueConnectionRequest request = new QueueConnectionRequest(ClientProxyMembershipID.getNewProxyMembership(InternalDistributedSystem.getAnyInstance()), 3, Collections.EMPTY_SET, "group1",true); QueueConnectionResponse response = (QueueConnectionResponse) TcpClient.requestToServer(InetAddress.getLocalHost(), port, request, REQUEST_TIMEOUT); Assert.assertEquals(new ArrayList(), response.getServers()); Assert.assertFalse(response.isDurableQueueFound()); } }
protected String getDurableId() { return getProxyID().getDurableId(); }
public String getHostAddress() { if(_id != null && _id.getDistributedMember() != null) return _id.getDistributedMember().getHost(); return null; }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); ClientProxyMembershipID cid = new ClientProxyMembershipID(); InternalDataSerializer.invokeFromData(cid, in); this.clientID = cid.canonicalReference(); }
/** * returns a string representation of this identifier, ignoring the toString * cache */ public String toStringNoCache() { StringBuffer sb = new StringBuffer("identity(").append(getDSMembership()) .append(",connection=").append(uniqueId); if (identity != null) { DurableClientAttributes dca = getDurableAttributes(); if (dca.getId().length() > 0) { sb.append(",durableAttributes=") .append(getDurableAttributes()).append(')').toString(); } } return sb.toString(); }
ClientProxyMembershipID proxyID = p.getProxyID(); if(!p.isConnected() && !proxyID.isDurable()){ return null; String clientName = proxyID.getDSMembership();
String clientIdFromProxy = ccp.getProxyID().getDSMembership(); 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"), ClientProxyMembershipID cliIdFrmProxy = conn.getProxyID(); if (clientID.equals(cliIdFrmProxy.getDSMembership() )) { String durableId = cliIdFrmProxy.getDurableId(); clientInfo = new ClientInfo((durableId != null && durableId.length() > 0 ? "Yes" : "No"), "N.A." , "N.A." );
/** * * @return String representing the DistributedSystemMembership of the Client VM */ public String getMembershipID() { return this.proxyId.getDSMembership(); } public int getSocketPort()
this.cancelCriterion = new Stopper(); if(Boolean.getBoolean("gemfire.SPECIAL_DURABLE")) { ClientProxyMembershipID.setPoolName(name); this.proxyId = ClientProxyMembershipID.getNewProxyMembership(ds); ClientProxyMembershipID.setPoolName(null); } else { this.proxyId = ClientProxyMembershipID.getNewProxyMembership(ds);
protected boolean isMember(ClientProxyMembershipID memberId) { return this.proxyID.equals(memberId); }
/** * Return the name of the region used for communicating interest changes * between servers. * * @return the name of the region used for communicating interest changes * between servers * * @since 5.6 */ protected String getInterestRegionName() { return getBaseRegionName() + "_interest"; }
public static ClientProxyMembershipID readCanonicalized(DataInput in) throws IOException, ClassNotFoundException { ClientProxyMembershipID result = DataSerializer.readObject(in); // We can't canonicalize if we have no identity. // I only saw this happen in unit tests that serialize "new ClientProxyMembershipID()". if (result == null || result.identity == null) { return result; } return result.canonicalReference(); } }
public ClientSession getClientSession(DistributedMember member) { return getCacheClientNotifier().getClientProxy( ClientProxyMembershipID.getClientId(member)); }
public void testBasic() throws Exception { factory.addConnection(0, 0, 1); factory.addConnection(0, 0, 2); factory.addConnection(0, 0, 3); manager = new QueueManagerImpl(pool, endpoints, source, factory, 2, 2000, logger, logger, ClientProxyMembershipID.getNewProxyMembership(ds)); manager.start(background); assertPortEquals(1, manager.getAllConnections().getPrimary()); assertPortEquals(new int[] {2, 3}, manager.getAllConnections().getBackups()); }