Package me.ahoo.cosid.snowflake
Class ClockSyncSnowflakeId
java.lang.Object
me.ahoo.cosid.snowflake.ClockSyncSnowflakeId
- All Implemented Interfaces:
Decorator<IdGenerator>
,IdGenerator
,IdGeneratorDecorator
,SnowflakeId
,Statistical
,StringIdGenerator
Clock Sync SnowflakeId.
-
Field Summary
Fields inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
TOTAL_BIT
-
Constructor Summary
ConstructorDescriptionClockSyncSnowflakeId
(SnowflakeId actual) ClockSyncSnowflakeId
(SnowflakeId 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.IdGenerator
generateAsString, idConverter
-
Constructor Details
-
ClockSyncSnowflakeId
-
ClockSyncSnowflakeId
public ClockSyncSnowflakeId(SnowflakeId actual, ClockBackwardsSynchronizer clockBackwardsSynchronizer)
-
-
Method Details
-
getActual
Description copied from interface:IdGeneratorDecorator
Get decorator actual id generator.- Specified by:
getActual
in interfaceDecorator<IdGenerator>
- Specified by:
getActual
in interfaceIdGeneratorDecorator
- Returns:
- actual id generator
-
generate
public long generate()Description copied from interface:IdGenerator
Generate distributed ID.- Specified by:
generate
in interfaceIdGenerator
- Specified by:
generate
in interfaceIdGeneratorDecorator
- Returns:
- generated distributed ID
-
stat
- Specified by:
stat
in interfaceIdGenerator
- Specified by:
stat
in interfaceIdGeneratorDecorator
- Specified by:
stat
in interfaceSnowflakeId
- Specified by:
stat
in interfaceStatistical
-
getEpoch
public long getEpoch()- Specified by:
getEpoch
in interfaceSnowflakeId
-
getTimestampBit
public int getTimestampBit()- Specified by:
getTimestampBit
in interfaceSnowflakeId
-
getMachineBit
public int getMachineBit()- Specified by:
getMachineBit
in interfaceSnowflakeId
-
getSequenceBit
public int getSequenceBit()- Specified by:
getSequenceBit
in interfaceSnowflakeId
-
isSafeJavascript
public boolean isSafeJavascript()Description copied from interface:SnowflakeId
是否是 Javascript 安全的 SnowflakeId.SafeJavaScriptSnowflakeId.JAVA_SCRIPT_MAX_SAFE_NUMBER_BIT
.- Specified by:
isSafeJavascript
in interfaceSnowflakeId
- Returns:
- Is it a JavaScript secure snowflakeId
-
getMaxTimestamp
public long getMaxTimestamp()- Specified by:
getMaxTimestamp
in interfaceSnowflakeId
-
getMaxMachineId
public int getMaxMachineId()- Specified by:
getMaxMachineId
in interfaceSnowflakeId
-
getMaxSequence
public long getMaxSequence()- Specified by:
getMaxSequence
in interfaceSnowflakeId
-
getLastTimestamp
public long getLastTimestamp()- Specified by:
getLastTimestamp
in interfaceSnowflakeId
-
getMachineId
public int getMachineId()- Specified by:
getMachineId
in interfaceSnowflakeId
-