public class TimeBasedEpochGenerator extends NoArgGenerator
As all JUG provided implementations, this generator is fully thread-safe.
Additionally it can also be made externally synchronized with other instances
(even ones running on other JVMs); to do this, use
FileBasedTimestampSynchronizer
(or
equivalent).
Modifier and Type | Field and Description |
---|---|
protected Random |
_random
Random number generator that this generator uses.
|
Constructor and Description |
---|
TimeBasedEpochGenerator(Random rnd) |
Modifier and Type | Method and Description |
---|---|
protected static long |
_toLong(byte[] buffer,
int offset) |
UUID |
generate() |
UUIDType |
getType()
Accessor for determining type of UUIDs (version) that this
generator instance will produce.
|
protected final Random _random
public TimeBasedEpochGenerator(Random rnd)
rnd
- Random number generator to use for generating UUIDs; if null,
shared default generator is used. Note that it is strongly recommend to
use a good (pseudo) random number generator; for example, JDK's
SecureRandom
.public UUIDType getType()
UUIDGenerator
getType
in class UUIDGenerator
public UUID generate()
generate
in class NoArgGenerator
protected static final long _toLong(byte[] buffer, int offset)
Copyright © 2023 FasterXML.com. All rights reserved.