public final class SnowflakeWorker extends Object
描述:分布式自增长ID
Twitter的 SnowFlake JAVA实现方案
0---0000000000 0000000000 0000000000 0000000000 0 --- 00000 ---00000 ---000000000000
64位ID (42(毫秒)+5(机器ID)+5(业务编码)+12(重复累加))| 构造器和说明 |
|---|
SnowflakeWorker(long baseTime,
int workerIdBits,
int datacenterIdBits,
int sequnceBits,
long workerId,
long datacenterId) |
SnowflakeWorker(long workerId,
long datacenterId) |
SnowflakeWorker(long baseTime,
long workerId,
long datacenterId) |
public SnowflakeWorker(long baseTime,
int workerIdBits,
int datacenterIdBits,
int sequnceBits,
long workerId,
long datacenterId)
public SnowflakeWorker(long baseTime,
long workerId,
long datacenterId)
public SnowflakeWorker(long workerId,
long datacenterId)
public long nextId()
public static void main(String[] args)
Copyright © 2019. All rights reserved.