Class UuidUtil
java.lang.Object
org.apache.logging.log4j.core.util.UuidUtil
Generates a unique ID. The generated UUID will be unique for approximately 8,925 years so long as
less than 10,000 IDs are generated per millisecond on the same device (as identified by its MAC address).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final AtomicInteger
private static final long[]
private static final long
private static final int
private static final long
private static final long
private static final Logger
private static final long
private static final long
private static final int
private static final long
private static final int
private static final int
private static final int
private static final int
private static final long
static final String
System property that may be used to seed the UUID generation with an integer value.private static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UUID
Generates Type 1 UUID.(package private) static long
initialize
(byte[] mac) Initializes this class
-
Field Details
-
EMPTY_LONG_ARRAY
private static final long[] EMPTY_LONG_ARRAY -
UUID_SEQUENCE
System property that may be used to seed the UUID generation with an integer value.- See Also:
-
LOGGER
-
ASSIGNED_SEQUENCES
- See Also:
-
COUNT
-
TYPE1
private static final long TYPE1- See Also:
-
VARIANT
private static final byte VARIANT- See Also:
-
SEQUENCE_MASK
private static final int SEQUENCE_MASK- See Also:
-
NUM_100NS_INTERVALS_SINCE_UUID_EPOCH
private static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH- See Also:
-
INITIAL_UUID_SEQNO
private static final long INITIAL_UUID_SEQNO -
LOW_MASK
private static final long LOW_MASK- See Also:
-
MID_MASK
private static final long MID_MASK- See Also:
-
HIGH_MASK
private static final long HIGH_MASK- See Also:
-
NODE_SIZE
private static final int NODE_SIZE- See Also:
-
SHIFT_2
private static final int SHIFT_2- See Also:
-
SHIFT_4
private static final int SHIFT_4- See Also:
-
SHIFT_6
private static final int SHIFT_6- See Also:
-
HUNDRED_NANOS_PER_MILLI
private static final int HUNDRED_NANOS_PER_MILLI- See Also:
-
LEAST
private static final long LEAST
-
-
Constructor Details
-
UuidUtil
private UuidUtil()
-
-
Method Details
-
initialize
static long initialize(byte[] mac) Initializes this class- Parameters:
mac
- MAC address- Returns:
- Least
-
getTimeBasedUuid
Generates Type 1 UUID. The time contains the number of 100NS intervals that have occurred since 00:00:00.00 UTC, 10 October 1582. Each UUID on a particular machine is unique to the 100NS interval until they rollover around 3400 A.D.- Digits 1-12 are the lower 48 bits of the number of 100 ns increments since the start of the UUID epoch.
- Digit 13 is the version (with a value of 1).
- Digits 14-16 are a sequence number that is incremented each time a UUID is generated.
- Digit 17 is the variant (with a value of binary 10) and 10 bits of the sequence number
- Digit 18 is final 16 bits of the sequence number.
- Digits 19-32 represent the system the application is running on.
- Returns:
- universally unique identifiers (UUID)
-