style: unify code style

This commit is contained in:
siujamo
2025-07-24 14:27:32 +08:00
parent 1f3c3df59d
commit 88c529e263
@@ -154,18 +154,17 @@ public final class SnowflakeIdentityGenerator implements IdentityGenerator<Long>
} }
// if generated at the same time, perform intra-millisecond sequences // if generated at the same time, perform intra-millisecond sequences
long sequenceBits = 12L; var sequenceBits = 12L;
if (lastTimestamp == timestamp) { if (lastTimestamp == timestamp) {
long sequenceMask = ~(-1L << sequenceBits); var sequenceMask = ~(-1L << sequenceBits);
sequence = (sequence + 1) & sequenceMask; sequence = (sequence + 1) & sequenceMask;
// sequence overflow in milliseconds // sequence overflow in milliseconds
if (sequence == 0) { if (sequence == 0) {
// block to the next millisecond, get a new timestamp // block to the next millisecond, get a new timestamp
timestamp = awaitToNextMillis(lastTimestamp); timestamp = awaitToNextMillis(lastTimestamp);
} }
} } else {
// timestamp change, sequence reset in milliseconds // timestamp change, sequence reset in milliseconds
else {
sequence = 0L; sequence = 0L;
} }