Package me.ahoo.cosid.cosid
Class ClockSyncCosIdGenerator
java.lang.Object
me.ahoo.cosid.cosid.ClockSyncCosIdGenerator
- All Implemented Interfaces:
CosIdGenerator
,Decorator<CosIdGenerator>
,IdGenerator
,Statistical
,StringIdGenerator
public class ClockSyncCosIdGenerator
extends Object
implements CosIdGenerator, Decorator<CosIdGenerator>
ClockSync
CosIdGenerator
.
If the clock is backwards, synchronize the clock and retry generating the Id.
-
Constructor Summary
ConstructorsConstructorDescriptionClockSyncCosIdGenerator
(CosIdGenerator actual, ClockBackwardsSynchronizer clockBackwardsSynchronizer) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.ahoo.cosid.cosid.CosIdGenerator
generate, generateAsString, idConverter
-
Constructor Details
-
ClockSyncCosIdGenerator
-
ClockSyncCosIdGenerator
public ClockSyncCosIdGenerator(CosIdGenerator actual, ClockBackwardsSynchronizer clockBackwardsSynchronizer)
-
-
Method Details
-
getActual
Description copied from interface:Decorator
Get decorator actual id generator.- Specified by:
getActual
in interfaceDecorator<CosIdGenerator>
- Returns:
- actual id generator
-
getMachineId
public int getMachineId()- Specified by:
getMachineId
in interfaceCosIdGenerator
-
getLastTimestamp
public long getLastTimestamp()- Specified by:
getLastTimestamp
in interfaceCosIdGenerator
-
getStateParser
- Specified by:
getStateParser
in interfaceCosIdGenerator
-
generateAsState
- Specified by:
generateAsState
in interfaceCosIdGenerator
-
stat
- Specified by:
stat
in interfaceCosIdGenerator
- Specified by:
stat
in interfaceIdGenerator
- Specified by:
stat
in interfaceStatistical
-