public final class UUIDTimer extends Object
Some additional assumptions about calculating the timestamp:
Note about synchronization: main synchronization point (as of version
3.1.1 and above) is getTimestamp()
, so caller need not
synchronize access explicitly.
Modifier and Type | Field and Description |
---|---|
protected Random |
_random
Random number generator used to generate additional information
to further reduce probability of collisions.
|
protected TimestampSynchronizer |
_syncer
Object used to reliably ensure that no multiple JVMs
generate UUIDs, and also that the time stamp value used for
generating time-based UUIDs is monotonically increasing
even if system clock moves backwards over a reboot (usually
due to some system level problem).
|
Constructor and Description |
---|
UUIDTimer(Random rnd,
TimestampSynchronizer sync) |
Modifier and Type | Method and Description |
---|---|
protected void |
getAndSetTimestamp(byte[] uuidBytes) |
int |
getClockSequence() |
long |
getTimestamp()
Method that constructs unique timestamp suitable for use for
constructing UUIDs.
|
protected final TimestampSynchronizer _syncer
See TimestampSynchronizer
for details.
protected final Random _random
public UUIDTimer(Random rnd, TimestampSynchronizer sync) throws IOException
IOException
public int getClockSequence()
public final long getTimestamp()
protected final void getAndSetTimestamp(byte[] uuidBytes)
Copyright © 2012-2014 FasterXML.com. All Rights Reserved.