public class Snowflake extends Object
0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000
第一位为未使用,接下来的41位为毫秒级时间(41位的长度可以使用69年)
然后是5位datacenterId和5位workerId(10位的长度最多支持部署1024个节点)
最后12位是毫秒内的计数(12位的计数顺序号支持每个节点每毫秒产生4096个ID序号)
参考:http://www.cnblogs.com/relucent/p/4955340.html
| Constructor and Description |
|---|
Snowflake(long workerId,
long datacenterId)
构造
|
Copyright © 2025. All rights reserved.