public final class DefaultKeyGenerator extends Object implements KeyGenerator
Use snowflake algorithm. Length is 64 bit.
1bit sign bit. 41bits timestamp offset from 2016.11.01(Sharding-Sphere distributed primary key published data) to now. 10bits worker process id. 12bits auto increment offset in one mills
Call @DefaultKeyGenerator.setWorkerId to set.
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
EPOCH |
| 构造器和说明 |
|---|
DefaultKeyGenerator() |
public static void setWorkerId(long workerId)
workerId - work process idpublic Number generateKey()
generateKey 在接口中 KeyGeneratorLong.Copyright © 2018. All rights reserved.