public final class CompositeIDSource extends Object implements IDSource<Long>
Thread-safe source for partitioned unique IDs. A single instance of this class represents a single 'partition' in the space of possible IDs. By creating multiple instances with different discriminators, multiple entities may generate globally unique IDs independently.
Any given instance of this class may generate a maximum of 2^31 unique values (the most significant 4 bytes are fixed and the least significant 4 bytes vary in sequence).
Constructor and Description |
---|
CompositeIDSource(int topPart) |
Modifier and Type | Method and Description |
---|---|
Long |
nextID()
Implementing classes are responsible for synchronization if concurrent invocations
of this method are required.
|