示例#1
0
  public boolean remoteEquals(Object obj) {
    if (obj != null && obj instanceof LiveRef) {
      LiveRef ref = (LiveRef) obj;

      TCPEndpoint thisEp = ((TCPEndpoint) ep);
      TCPEndpoint refEp = ((TCPEndpoint) ref.ep);

      RMIClientSocketFactory thisClientFactory = thisEp.getClientSocketFactory();
      RMIClientSocketFactory refClientFactory = refEp.getClientSocketFactory();

      /**
       * Fix for 4254103: LiveRef.remoteEquals should not fail if one of the objects in the
       * comparison has a null server socket. Comparison should only consider the following
       * criteria:
       *
       * <p>hosts, ports, client socket factories and object IDs.
       */
      if (thisEp.getPort() != refEp.getPort() || !thisEp.getHost().equals(refEp.getHost())) {
        return false;
      }
      if ((thisClientFactory == null) ^ (refClientFactory == null)) {
        return false;
      }
      if ((thisClientFactory != null)
          && !((thisClientFactory.getClass() == refClientFactory.getClass())
              && (thisClientFactory.equals(refClientFactory)))) {
        return false;
      }
      return (id.equals(ref.id));
    } else {
      return false;
    }
  }
示例#2
0
  public boolean equals(Object obj) {
    if (obj != null && obj instanceof LiveRef) {
      LiveRef ref = (LiveRef) obj;

      return (ep.equals(ref.ep) && id.equals(ref.id) && isLocal == ref.isLocal);
    } else {
      return false;
    }
  }