public static ClientProxyMembershipID getClientId(DistributedMember member) { return new ClientProxyMembershipID(member); }
/** method to obtain ClientProxyMembership for client side */ public static synchronized ClientProxyMembershipID getNewProxyMembership(DistributedSystem sys) { byte[] ba = initializeAndGetDSIdentity(sys); return new ClientProxyMembershipID(++synch_counter, ba); }
public HAEventWrapper(EventID eventId) { this.eventIdentifier = eventId; this.clientUpdateMessage = new ClientUpdateMessageImpl(EnumListenerEvent.AFTER_CREATE, new ClientProxyMembershipID(), eventId); rcUpdater.set(this, 0); putInProgressCountUpdater.set(this, 0); }
private void setClientProxyMembershipId() { ServerLocation serverLocation = new ServerLocation( ((InetSocketAddress) this.getSocket().getRemoteSocketAddress()).getHostName(), this.getSocketPort()); DistributedMember distributedMember = new InternalDistributedMember(serverLocation); // no handshake for new client protocol. clientProxyMembershipID = new ClientProxyMembershipID(distributedMember); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.processorId = in.readInt(); this.clientId = new ClientProxyMembershipID(); InternalDataSerializer.invokeFromData(this.clientId, in); this.clientMessage = new ClientInterestMessageImpl(); InternalDataSerializer.invokeFromData(this.clientMessage, in); } }
/** * Calls toData() on its clientUpdateMessage present in the haContainer (client-messages-region or * the map). * * @param out The output stream which the object should be written to. */ @Override public void toData(DataOutput out) throws IOException { ClientUpdateMessageImpl cum = (ClientUpdateMessageImpl) this.haContainer.get(this); // If the dispatcher sends the cum object to the client and removes it from // the haContainer before we do haContainer.get() (above), we indicate that // by sending false boolean value. if (cum != null) { DataSerializer.writePrimitiveBoolean(true, out); DataSerializer.writeObject(cum.getEventId(), out); } else { DataSerializer.writePrimitiveBoolean(false, out); DataSerializer.writeObject(new EventID(), out); // Create a dummy ClientUpdateMessageImpl instance cum = new ClientUpdateMessageImpl(EnumListenerEvent.AFTER_CREATE, new ClientProxyMembershipID(), null); } InternalDataSerializer.invokeToData(cum, out); if (cum.hasCqs()) { DataSerializer.writeConcurrentHashMap(cum.getClientCqs(), out); } }
@Test public void constructCqServerNameShouldReturnSameResultRegardlessOfOptimizedCacheNames() { CqServiceImpl cqService = new CqServiceImpl(Fakes.cache()); ClientProxyMembershipID proxyMembershipID = new ClientProxyMembershipID(Fakes.cache().getDistributedSystem().getDistributedMember()); String name1 = cqService.constructServerCqName("myCq", proxyMembershipID); String name2 = cqService.constructServerCqName("myCq", proxyMembershipID); assertEquals(name1, name2); }
@Test public void constructCqServerNameShouldReturnCorrectResultsEvenAfterCqClosingRemovesValuesFromOptimizedCache() throws Exception { CqServiceImpl cqService = new CqServiceImpl(Fakes.cache()); ClientProxyMembershipID proxyMembershipID = new ClientProxyMembershipID(Fakes.cache().getDistributedSystem().getDistributedMember()); String name1 = cqService.constructServerCqName("myCq", proxyMembershipID); cqService.closeCq("myCq", proxyMembershipID); String name2 = cqService.constructServerCqName("myCq", proxyMembershipID); assertEquals(name1, name2); }
@Test public void testEqualsIgnoresUUIDBytes() throws Exception { InternalDistributedMember id = new InternalDistributedMember(InetAddress.getLocalHost(), 1234); id.setVersionObjectForTest(Version.GFE_90); byte[] memberIdBytes = EventID.getMembershipId(new ClientProxyMembershipID(id)); byte[] memberIdBytesWithoutUUID = new byte[memberIdBytes.length - (2 * 8 + 1)];// UUID bytes + // weight byte System.arraycopy(memberIdBytes, 0, memberIdBytesWithoutUUID, 0, memberIdBytesWithoutUUID.length); ThreadIdentifier threadIdWithUUID = new ThreadIdentifier(memberIdBytes, 1); ThreadIdentifier threadIdWithoutUUID = new ThreadIdentifier(memberIdBytesWithoutUUID, 1); assertEquals(threadIdWithoutUUID, threadIdWithUUID); assertEquals(threadIdWithUUID, threadIdWithoutUUID); assertEquals(threadIdWithoutUUID.hashCode(), threadIdWithUUID.hashCode()); EventID eventIDWithUUID = new EventID(memberIdBytes, 1, 1); EventID eventIDWithoutUUID = new EventID(memberIdBytesWithoutUUID, 1, 1); assertEquals(eventIDWithUUID, eventIDWithoutUUID); assertEquals(eventIDWithoutUUID, eventIDWithUUID); assertEquals(eventIDWithoutUUID.hashCode(), eventIDWithUUID.hashCode()); }