类 SnowFlowerIdGenerator
java.lang.Object
com.alibaba.nacos.core.distributed.id.SnowFlowerIdGenerator
- 所有已实现的接口:
com.alibaba.nacos.consistency.IdGenerator
public class SnowFlowerIdGenerator
extends Object
implements com.alibaba.nacos.consistency.IdGenerator
copy from http://www.cluozy.com/home/hexo/2018/08/11/shariding-JDBC-snowflake/.
WorkerId generation policy: Calculate the InetAddress hashcode
The repeat rate of the dataCenterId, the value of the maximum dataCenterId times the time of each Raft election. The time for raft to select the master is generally measured in seconds. If the interval of an election is 5 seconds, it will take 150 seconds for the DataCenterId to be repeated. This is still based on the situation that the new master needs to be selected after each election of the Leader
- 作者:
- liaochuntao
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
-
字段详细资料
-
EPOCH
public static final long EPOCHStart time intercept (2018-08-05 08:34)- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
SnowFlowerIdGenerator
public SnowFlowerIdGenerator()
-
-
方法详细资料
-
init
public void init()- 指定者:
init在接口中com.alibaba.nacos.consistency.IdGenerator
-
currentId
public long currentId()- 指定者:
currentId在接口中com.alibaba.nacos.consistency.IdGenerator
-
nextId
public long nextId()- 指定者:
nextId在接口中com.alibaba.nacos.consistency.IdGenerator
-
info
- 指定者:
info在接口中com.alibaba.nacos.consistency.IdGenerator
-
initialize
public void initialize(long workerId)init- 参数:
workerId- worker id (0~1024)
-