From f219680d42e4ccb80fefd3e72ef848bfc9ab5488 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 21 Feb 2017 15:05:06 -0500 Subject: [PATCH] Add equals/hashcode for STOMP Subscription Issue: SPR-15229 --- .../broker/DefaultSubscriptionRegistry.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java index 48a42b2196..140ad83f71 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java @@ -497,6 +497,23 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry { return this.selectorExpression; } + @Override + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (other == null || getClass() != other.getClass()) { + return false; + } + return getId().equals(((Subscription) other).getId()); + + } + + @Override + public int hashCode() { + return getId().hashCode(); + } + @Override public String toString() { return "subscription(id=" + this.id + ")";