Package me.ahoo.cosid.segment
Class IdSegmentDistributor.Atomic
java.lang.Object
me.ahoo.cosid.segment.IdSegmentDistributor.Atomic
- All Implemented Interfaces:
- Grouped,- IdSegmentDistributor
- Enclosing interface:
- IdSegmentDistributor
Atomic implementation of IdSegmentDistributor for testing purposes.
 
 
This implementation uses atomic operations to allocate ID segments, making it suitable for single-instance scenarios or testing.
- 
Nested Class SummaryNested classes/interfaces inherited from interface me.ahoo.cosid.segment.IdSegmentDistributorIdSegmentDistributor.Atomic, IdSegmentDistributor.Mock
- 
Field SummaryFields inherited from interface me.ahoo.cosid.segment.IdSegmentDistributorDEFAULT_OFFSET, DEFAULT_SEGMENTS, DEFAULT_STEP
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.ahoo.cosid.segment.IdSegmentDistributorallowReset, getNamespacedName, getStep, nextIdSegment, nextIdSegment, nextIdSegment, nextIdSegmentChain, nextIdSegmentChain, nextMaxId
- 
Constructor Details- 
Atomicpublic Atomic()Create a new Atomic distributor with default step size.
- 
Atomicpublic Atomic(long step) Create a new Atomic distributor with custom step size.- Parameters:
- step- The step size for ID segments
 
 
- 
- 
Method Details- 
getNamespaceGet the namespace for this distributor.- Specified by:
- getNamespacein interface- IdSegmentDistributor
- Returns:
- The namespace
 
- 
getNameGet the name for this distributor.- Specified by:
- getNamein interface- IdSegmentDistributor
- Returns:
- The name
 
- 
getSteppublic long getStep()Get the step size for ID segments.- Specified by:
- getStepin interface- IdSegmentDistributor
- Returns:
- The step size
 
- 
nextMaxIdpublic long nextMaxId(long step) Allocate the next maximum ID for the specified step size.- Specified by:
- nextMaxIdin interface- IdSegmentDistributor
- Parameters:
- step- The step size for allocation
- Returns:
- The maximum ID in the allocated range
 
 
-