You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public LeafSnowflakeService(@value("${leaf.snowflake.enable}") boolean leafSnowflakeEnable, @value("${leaf.snowflake.zk.address}") String leafSnowflakeZkAddress, @value("${leaf.snowflake.zk.port}") int leafSnowflakeZkPort) throws InitException {
if (leafSnowflakeEnable) {
idGen = new SnowflakeIDGenImpl(leafSnowflakeZkAddress, leafSnowflakeZkPort);
if (idGen.init()) {
log.info("Snowflake Service Init Successfully");
} else {
throw new InitException("Snowflake Service Init Fail");
}
} else {
idGen = new ZeroIDGen();
log.info("Zero ID Gen Service Init Successfully");
}
}
BTW:好像没找到 maven 包,哪里可以下载 jar 包?
The text was updated successfully, but these errors were encountered:
下面是示例 demo 是直接用 @value,共用 application.properties 或 apollo 配置,不用多增加一个额外的 leaf.properties 配置文件,而且不需要额外写读取 leaf.properties 配置的代码。
具体如下,测试可行:
public LeafSnowflakeService(@value("${leaf.snowflake.enable}") boolean leafSnowflakeEnable,
@value("${leaf.snowflake.zk.address}") String leafSnowflakeZkAddress,
@value("${leaf.snowflake.zk.port}") int leafSnowflakeZkPort) throws InitException {
if (leafSnowflakeEnable) {
idGen = new SnowflakeIDGenImpl(leafSnowflakeZkAddress, leafSnowflakeZkPort);
if (idGen.init()) {
log.info("Snowflake Service Init Successfully");
} else {
throw new InitException("Snowflake Service Init Fail");
}
} else {
idGen = new ZeroIDGen();
log.info("Zero ID Gen Service Init Successfully");
}
}
BTW:好像没找到 maven 包,哪里可以下载 jar 包?
The text was updated successfully, but these errors were encountered: