You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/03/08 12:30:54 UTC

[rocketmq-exporter] branch master updated: hashCode() and equats() calculates all fields

This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-exporter.git


The following commit(s) were added to refs/heads/master by this push:
     new 9df06e7  hashCode() and equats() calculates all fields
     new 44d6083  Merge pull request #96 from cserwen/fix_hash_collision
9df06e7 is described below

commit 9df06e73a0931b83dcad976936616b526d618ca3
Author: dengzhiwen1 <de...@xiaomi.com>
AuthorDate: Tue Mar 8 17:50:52 2022 +0800

    hashCode() and equats() calculates all fields
---
 .../rocketmq/exporter/model/metrics/ConsumerTopicDiffMetric.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/rocketmq/exporter/model/metrics/ConsumerTopicDiffMetric.java b/src/main/java/org/apache/rocketmq/exporter/model/metrics/ConsumerTopicDiffMetric.java
index cfd0269..95e4a5c 100644
--- a/src/main/java/org/apache/rocketmq/exporter/model/metrics/ConsumerTopicDiffMetric.java
+++ b/src/main/java/org/apache/rocketmq/exporter/model/metrics/ConsumerTopicDiffMetric.java
@@ -69,7 +69,9 @@ public class ConsumerTopicDiffMetric {
         ConsumerTopicDiffMetric other = (ConsumerTopicDiffMetric) obj;
 
         return other.group.equals(group) &&
-                other.topic.equals(topic);
+                other.topic.equals(topic) &&
+                other.countOfOnlineConsumers.equals(countOfOnlineConsumers) &&
+                other.msgModel.equals(msgModel);
     }
 
     @Override
@@ -77,11 +79,14 @@ public class ConsumerTopicDiffMetric {
         int hash = 1;
         hash = 37 * hash + group.hashCode();
         hash = 37 * hash + topic.hashCode();
+        hash = 37 * hash + countOfOnlineConsumers.hashCode();
+        hash = 37 * hash + msgModel.hashCode();
         return hash;
     }
 
     @Override
     public String toString() {
-        return "ConsumerGroup: " + group + " Topic: " + topic;
+        return "ConsumerGroup: " + group + " Topic: " + topic + " countOfOnlineConsumers: " + countOfOnlineConsumers
+                + "msgModel: " + msgModel;
     }
 }