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();
  }
 @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);
 }
 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;
   }
 }
 /**
  * Reads an object from a <code>DataInput</code>.
  *
  * @throws IOException If this serializer cannot read an object from <code>in</code>.
  * @throws ClassNotFoundException If the class for an object being restored cannot be found.
  * @see #toData
  */
 @Override
 public void fromData(DataInput in) throws IOException, ClassNotFoundException {
   // Note: does not call super.fromData what a HACK
   _operation = EnumListenerEvent.getEnumListenerEvent(in.readByte());
   int instantiatorCount = in.readInt(); // is byte suficient for this ?
   this.serializedInstantiators = new byte[instantiatorCount][];
   for (int i = 0; i < instantiatorCount; i++) {
     this.serializedInstantiators[i] = DataSerializer.readByteArray(in);
   }
   _membershipId = ClientProxyMembershipID.readCanonicalized(in);
   _eventIdentifier = (EventID) DataSerializer.readObject(in);
   DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
   if (ds != null) {
     _logger = ds.getLogWriter().convertToLogWriterI18n();
   }
 }