Package me.ahoo.cosid.snowflake
Class MillisecondSnowflakeId
java.lang.Object
me.ahoo.cosid.snowflake.AbstractSnowflakeId
me.ahoo.cosid.snowflake.MillisecondSnowflakeId
- All Implemented Interfaces:
IdGenerator
,SnowflakeId
,Statistical
,StringIdGenerator
Millisecond SnowflakeId.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final long
static final int
Fields inherited from class me.ahoo.cosid.snowflake.AbstractSnowflakeId
epoch, lastTimestamp, machineBit, machineId, machineLeft, maxMachineId, maxSequence, maxTimestamp, sequence, sequenceBit, timestampBit, timestampLeft
Fields inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
TOTAL_BIT
-
Constructor Summary
ConstructorDescriptionMillisecondSnowflakeId
(int machineId) MillisecondSnowflakeId
(int machineBit, int machineId) MillisecondSnowflakeId
(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId) MillisecondSnowflakeId
(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId, long sequenceResetThreshold) -
Method Summary
Methods inherited from class me.ahoo.cosid.snowflake.AbstractSnowflakeId
generate, getEpoch, getLastTimestamp, getMachineBit, getMachineId, getMaxMachineId, getMaxSequence, getMaxTimestamp, getSequenceBit, getTimestampBit, nextTime
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
Methods inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
isSafeJavascript, stat
-
Field Details
-
DEFAULT_TIMESTAMP_BIT
public static final int DEFAULT_TIMESTAMP_BIT- See Also:
-
DEFAULT_MACHINE_BIT
public static final int DEFAULT_MACHINE_BIT- See Also:
-
DEFAULT_SEQUENCE_BIT
public static final int DEFAULT_SEQUENCE_BIT- See Also:
-
DEFAULT_SEQUENCE_RESET_THRESHOLD
public static final long DEFAULT_SEQUENCE_RESET_THRESHOLD- See Also:
-
-
Constructor Details
-
MillisecondSnowflakeId
public MillisecondSnowflakeId(int machineId) -
MillisecondSnowflakeId
public MillisecondSnowflakeId(int machineBit, int machineId) -
MillisecondSnowflakeId
public MillisecondSnowflakeId(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId) -
MillisecondSnowflakeId
public MillisecondSnowflakeId(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId, long sequenceResetThreshold)
-
-
Method Details
-
getCurrentTime
protected long getCurrentTime()Description copied from class:AbstractSnowflakeId
get current timestamp.- Specified by:
getCurrentTime
in classAbstractSnowflakeId
- Returns:
- current timestamp
-