Skip to content

Commit

Permalink
Fix AlphaNumericMessage.equals
Browse files Browse the repository at this point in the history
I noticed excessive CPU usage in HashMap lookups in StatsDAggregator.
The stacks shows that the HashMap had devolved into a TreeMap which
happens after frequent hash collisions. That got me looking at the
implementations of hashCode/equals in the Message heirarchy and
this seems a likely culprit.
  • Loading branch information
retronym committed May 17, 2022
1 parent 3e84dc7 commit 13ed366
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/timgroup/statsd/AlphaNumericMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public boolean equals(Object object) {

if (object instanceof AlphaNumericMessage ) {
AlphaNumericMessage msg = (AlphaNumericMessage)object;
return super.equals(msg) && (this.value == msg.getValue());
return super.equals(msg) && (this.value.equals(msg.getValue()));
}

return false;
Expand Down

0 comments on commit 13ed366

Please sign in to comment.