Skip to content

Commit

Permalink
Merge pull request apache#83 from sharajava/master
Browse files Browse the repository at this point in the history
issue apache#21 fix the magic number first
  • Loading branch information
sharajava authored Jan 14, 2019
2 parents 4d52c4d + a50f959 commit 16d892a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -28,14 +28,14 @@ public class UUIDGenerator {

private static AtomicLong UUID = new AtomicLong(1000);

private static int UUID_INTERNAL = 200000000;
private static int UUID_INTERNAL = 2000000000;

public static long generateUUID() {
long id = UUID.incrementAndGet();
if (id > 2000000000) {
if (id > UUID_INTERNAL) {
synchronized (UUID) {
if (UUID.get() >= id) {
id -= 2000000000;
id -= UUID_INTERNAL;
UUID.set(id);
}
}

0 comments on commit 16d892a

Please sign in to comment.