Package io.cucumber.core.eventbus
Class IncrementingUuidGenerator
java.lang.Object
io.cucumber.core.eventbus.IncrementingUuidGenerator
- All Implemented Interfaces:
UuidGenerator
,Supplier<UUID>
Thread-safe and collision-free UUID generator for single JVM. This is a
sequence generator and each instance has its own counter. This generator is
about 100 times faster than #RandomUuidGenerator.
Properties:
- thread-safe
- collision-free in the same classloader
- almost collision-free in different classloaders / JVMs
- UUIDs generated using the instances from the same classloader are sortable
UUID version 8 (custom) / variant 2 ...
| 40 bits | 8 bits | 4 bits | 12 bits | 2 bits | 62 bits |
| -------------------| -------------- | ------- | ------------- | ------- | ------- |
| LSBs of epoch-time | sessionCounter | version | classloaderId | variant | counter |
-
Constructor Details
-
IncrementingUuidGenerator
public IncrementingUuidGenerator()
-
-
Method Details
-
generateId
Generate a new UUID. Will throw an exception when out of capacity.- Specified by:
generateId
in interfaceUuidGenerator
- Returns:
- a non-null UUID
- Throws:
CucumberException
- when out of capacity
-