java.lang.Object
io.ebeaninternal.server.idgen.UuidV1RndIdGenerator
- All Implemented Interfaces:
PlatformIdGenerator
- Direct Known Subclasses:
UuidV1IdGenerator
IdGenerator for (pseudo) type 1 UUIDs.
This implementation generates a type 1 UUID according to https://tools.ietf.org/html/rfc4122.html#section-4.2 but has no persistence storage. It generates a new random 47 bit node ID with every UUID.
Use this, if you want randomness in your UUIDs but want to take advantage of index optimizations of the database. It may be good with AUTO_BINARY_OPTIMIZED and MySql.
See: https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicIntegerstatic final UuidV1RndIdGeneratorprotected static final System.Loggerprotected static final longprotected final AtomicLongprotected static final longFields inherited from interface io.ebean.config.dbplatform.PlatformIdGenerator
AUTO_UUID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidComputes the internal offset between System.nanoTime() and System.currentTimeMillis().getName()Returns "uuid".protected byte[]returns a random 47 bit value according to https://tools.ietf.org/html/rfc4122.html#section-4.5booleanReturns false.Return UUID from UUID.randomUUID();voidpreAllocateIds(int allocateSize) Ignored for UUID as not required as a performance optimisation.protected voidMethod to overwrite to save the state in a non volatile place.
-
Field Details
-
log
-
UUID_EPOCH_OFFSET
protected static final long UUID_EPOCH_OFFSET- See Also:
-
MILLIS_TO_UUID
protected static final long MILLIS_TO_UUID- See Also:
-
INSTANCE
-
clockSeq
-
timeStamp
-
-
Constructor Details
-
UuidV1RndIdGenerator
public UuidV1RndIdGenerator()
-
-
Method Details
-
computeNanoOffset
protected void computeNanoOffset()Computes the internal offset between System.nanoTime() and System.currentTimeMillis(). -
saveState
protected void saveState()Method to overwrite to save the state in a non volatile place. -
getNodeIdBytes
protected byte[] getNodeIdBytes()returns a random 47 bit value according to https://tools.ietf.org/html/rfc4122.html#section-4.5 -
nextId
Return UUID from UUID.randomUUID();- Specified by:
nextIdin interfacePlatformIdGenerator
-
getName
Returns "uuid".- Specified by:
getNamein interfacePlatformIdGenerator
-
isDbSequence
public boolean isDbSequence()Returns false.- Specified by:
isDbSequencein interfacePlatformIdGenerator
-
preAllocateIds
public void preAllocateIds(int allocateSize) Ignored for UUID as not required as a performance optimisation.- Specified by:
preAllocateIdsin interfacePlatformIdGenerator
-