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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longstatic final intFields inherited from class me.ahoo.cosid.snowflake.AbstractSnowflakeId
epoch, lastTimestamp, machineBit, machineId, machineLeft, maxMachineId, maxSequence, maxTimestamp, sequence, sequenceBit, timestampBit, timestampLeftFields inherited from interface me.ahoo.cosid.snowflake.SnowflakeId
TOTAL_BIT -
Constructor Summary
ConstructorsConstructorDescriptionSecondSnowflakeId(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, nextTimeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.ahoo.cosid.IdGenerator
generateAsString, idConverterMethods 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:AbstractSnowflakeIdget current timestamp.- Specified by:
getCurrentTimein classAbstractSnowflakeId- Returns:
- current timestamp
-