@Override
 public boolean equals(Object o) {
   if (o instanceof SubscriptionState) {
     SubscriptionState subscription = (SubscriptionState) o;
     return BrokerUtil.sameStringValue(subscription.getLocalTopic(), this.getLocalTopic())
         && BrokerUtil.sameStringValue(subscription.getXpathString(), this.getXpathString())
         && BrokerUtil.sameStringValue(
             subscription.getConsumerIPAddressStr(), this.getConsumerIPAddressStr())
         && equalReferenceParameters(subscription);
   }
   return false;
 }
  private boolean equalReferenceParameters(SubscriptionState anotherSubscription) {

    Map<QName, OMElement> otherRefProperties =
        anotherSubscription.getConsumerReference().getAllReferenceParameters();
    Map<QName, OMElement> myRefProperties = getConsumerReference().getAllReferenceParameters();

    /*
     * Basic comparison
     */
    if (otherRefProperties == null && myRefProperties == null) {
      return true;
    } else if (otherRefProperties == null || myRefProperties == null) {
      return false;
    } else if (otherRefProperties.size() != myRefProperties.size()) {
      return false;
    }

    /*
     * This OMElementComparator supports ignore list, but we don't use it here.
     */
    Iterator<Entry<QName, OMElement>> iterator = otherRefProperties.entrySet().iterator();
    while (iterator.hasNext()) {

      Entry<QName, OMElement> entry = iterator.next();
      if (!myRefProperties.containsKey(entry.getKey())) {
        return false;
      }

      OMElement myElement = myRefProperties.get(entry.getKey());
      OMElement otherElement = entry.getValue();

      if (!OMElementComparator.compare(myElement, otherElement)) {
        return false;
      }
    }
    return true;
  }