You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/11/08 22:27:38 UTC
git commit: https://issues.apache.org/jira/browse/AMQ-4853
Updated Branches:
refs/heads/trunk 692428eee -> 8f078a3f4
https://issues.apache.org/jira/browse/AMQ-4853
Add hashCode and equals override so that this object can be used in
collections properly
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8f078a3f
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8f078a3f
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8f078a3f
Branch: refs/heads/trunk
Commit: 8f078a3f4ce0599f958c1363e55fbc966013cdba
Parents: 692428e
Author: Timothy Bish <ta...@gmai.com>
Authored: Fri Nov 8 16:06:49 2013 -0500
Committer: Timothy Bish <ta...@gmai.com>
Committed: Fri Nov 8 16:27:13 2013 -0500
----------------------------------------------------------------------
.../apache/activemq/command/ConsumerInfo.java | 29 ++++++++++++++++++++
1 file changed, 29 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/8f078a3f/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
index 3e8ec54..01f2243 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
@@ -114,6 +114,7 @@ public class ConsumerInfo extends BaseCommand {
return subscriptionName != null;
}
+ @Override
public byte getDataStructureType() {
return DATA_STRUCTURE_TYPE;
}
@@ -343,6 +344,7 @@ public class ConsumerInfo extends BaseCommand {
this.additionalPredicate = additionalPredicate;
}
+ @Override
public Response visit(CommandVisitor visitor) throws Exception {
return visitor.processAddConsumer(this);
}
@@ -434,6 +436,33 @@ public class ConsumerInfo extends BaseCommand {
return result;
}
+ @Override
+ public int hashCode() {
+ return (consumerId == null) ? 0 : consumerId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ ConsumerInfo other = (ConsumerInfo) obj;
+
+ if (consumerId == null && other.consumerId != null) {
+ return false;
+ } else if (!consumerId.equals(other.consumerId)) {
+ return false;
+ }
+ return true;
+ }
+
/**
* Tracks the original subscription id that causes a subscription to
* percolate through a network when networkTTL > 1. Tracking the original