public class UniqueIdGenerator
extends java.lang.Object
| Constructor and Description |
|---|
UniqueIdGenerator(Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
generateId()
Generate a new unique ID suitable for Criteo backends
|
public UniqueIdGenerator(@NonNull
Clock clock)
@NonNull public java.lang.String generateId()
The output represents a 32 bytes unique ID formatted into hexadecimal. The 8 first (MSB) bytes represent the UNIX timestamp in seconds. The 24 following ones are random from a cryptographic random generator. This ensures keeping a very low probability of collision.
At SDK level, a simpler UUID.randomUUID() would be sufficient. But those ids are
expected to be sent to a Criteo backend and should then be (almost) unique at Criteo level and
scale with it.
This is based on an algorithm already done in C# and Scala to generate impression id.
Generation IDs are suitable for: