public static class IdGenerators.SimpleIncrementingIdGenerator extends Object implements IdGenerator
AtomicLong
s, for topBits
and bottomBits
,
respectively.
Begins with {0, 1}; incremented on each use.
Note: after each 2^63
generations, a duplicate UUID
can be returned in a multi-threaded environment, if a second thread sees the old topBits
before it is incremented by the thread detecting the bottomBits roll over.
The duplicate would be from around the previous rollover and
the chance of such a value still being in the system is exceedingly small.
If your system might be impacted by this situation, you should choose another IdGenerator
.
Also note that there is no persistence, so this generator starts at {0, 1} each time the system
is initialized. Therefore, it is not suitable when persisting messages based on their ID; it should
only be used when the absolute best performance is required and messages are not persisted.
Constructor and Description |
---|
SimpleIncrementingIdGenerator() |
public UUID generateId()
generateId
in interface IdGenerator