dweiss commented on code in PR #15631:
URL: https://github.com/apache/lucene/pull/15631#discussion_r2742843967


##########
lucene/core/src/java/org/apache/lucene/util/StringHelper.java:
##########
@@ -458,11 +458,12 @@ public static byte[] randomId() {
     //     what impact that has on the period, whereas the simple ++ (mod 
2^128)
     //     we use here is guaranteed to have the full period.
 
-    byte[] bits;
+    final BigInteger scratch;
     synchronized (idLock) {
-      bits = nextId.toByteArray();
+      scratch = nextId;
       nextId = nextId.add(BigInteger.ONE).and(mask128);
     }
+    byte[] bits = scratch.toByteArray();

Review Comment:
   Can we just move bits before the synchronized block and remove scratch 
entirely? if nextId is immutable, it shouldn't make any difference.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to