You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/03 06:11:36 UTC

[GitHub] [pulsar] gmethvin commented on a change in pull request #9440: [Issue 9438][pulsar-client] Fix inconsistent equals and hashCode for MessageIds

gmethvin commented on a change in pull request #9440:
URL: https://github.com/apache/pulsar/pull/9440#discussion_r569154763



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java
##########
@@ -63,17 +78,17 @@ public int getPartitionIndex() {
 
     @Override
     public int hashCode() {
-        return (int) (31 * (ledgerId + 31 * entryId) + partitionIndex);
+        return Objects.hash(ledgerId, entryId, partitionIndex, batchIndex);

Review comment:
       It seems like `Objects.hash` is used elsewhere in the codebase and I generally prefer it to manually implementing `hashCode`, but I don't have a strong opinion. Happy to change it back.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org