codings-dan commented on code in PR #706:
URL: https://github.com/apache/ratis/pull/706#discussion_r941369473


##########
ratis-common/src/main/java/org/apache/ratis/rpc/CallId.java:
##########
@@ -27,6 +28,17 @@
 public final class CallId {
   private static final AtomicLong CALL_ID_COUNTER = new AtomicLong();
 
+  private static final Comparator<Long> COMPARATOR = (left, right) -> {
+    final long diff = left - right;
+    // check diff < Long.MAX_VALUE/2 for the possibility of numerical overflow.
+    return diff == 0? 0: diff > 0 && diff < Long.MAX_VALUE/2? 1: -1;

Review Comment:
   Why this `COMPARATOR` is different from `GrpcLogAppender#CALL_ID_COMPARATOR`?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to