Package me.ahoo.cosid.snowflake
Class SecondSnowflakeId
java.lang.Object
me.ahoo.cosid.snowflake.AbstractSnowflakeId
me.ahoo.cosid.snowflake.SecondSnowflakeId
- All Implemented Interfaces:
IdGenerator
,SnowflakeId
,Statistical
,StringIdGenerator
Second 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
ConstructorDescriptionSecondSnowflakeId
(int machineId) SecondSnowflakeId
(int machineBit, int machineId) SecondSnowflakeId
(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId) SecondSnowflakeId
(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
-
SecondSnowflakeId
public SecondSnowflakeId(int machineId) -
SecondSnowflakeId
public SecondSnowflakeId(int machineBit, int machineId) -
SecondSnowflakeId
public SecondSnowflakeId(long epoch, int timestampBit, int machineBit, int sequenceBit, int machineId) -
SecondSnowflakeId
public SecondSnowflakeId(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
-