Package org.uncommons.util.id
Class CompositeIDSource
- java.lang.Object
-
- org.uncommons.util.id.CompositeIDSource
-
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 Summary
Constructors Constructor Description CompositeIDSource(int topPart)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
nextID()
Implementing classes are responsible for synchronization if concurrent invocations of this method are required.
-