public final class SafeJavaScriptSnowflakeId
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static long |
JAVA_SCRIPT_MAX_SAFE_NUMBER |
static int |
JAVA_SCRIPT_MAX_SAFE_NUMBER_BIT |
| Constructor and Description |
|---|
SafeJavaScriptSnowflakeId() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isSafeJavaScript(long id) |
static MillisecondSnowflakeId |
ofMillisecond(long machineId)
Max Sequence (9 bits) = ((1<<)*1000) = 512000 (TPS)
Max Machine (3 bits) = 1<<3 = 8
Max Timestamp = 2199023255551 ms ~~ 69.7 years
|
static MillisecondSnowflakeId |
ofMillisecond(long epoch,
int timestampBit,
int machineBit,
int sequenceBit,
long machineId,
long sequenceResetThreshold) |
static SecondSnowflakeId |
ofSecond(long machineId)
Max Sequence (19 bits) = (1<<19) = 524288 (TPS).
|
static SecondSnowflakeId |
ofSecond(long epoch,
int timestampBit,
int machineBit,
int sequenceBit,
long machineId,
long sequenceResetThreshold) |
public static final int JAVA_SCRIPT_MAX_SAFE_NUMBER_BIT
public static final long JAVA_SCRIPT_MAX_SAFE_NUMBER
public static boolean isSafeJavaScript(long id)
public static MillisecondSnowflakeId ofMillisecond(long epoch, int timestampBit, int machineBit, int sequenceBit, long machineId, long sequenceResetThreshold)
public static MillisecondSnowflakeId ofMillisecond(long machineId)
machineId - 服务实例编号public static SecondSnowflakeId ofSecond(long epoch, int timestampBit, int machineBit, int sequenceBit, long machineId, long sequenceResetThreshold)
public static SecondSnowflakeId ofSecond(long machineId)
machineId - 服务实例编号