szetszwo commented on code in PR #706:
URL: https://github.com/apache/ratis/pull/706#discussion_r941585168


##########
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:
   It generates call IDs in a different way -- this only allows >=0 values but 
GrpcLogAppender allows +/- values.



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