summaryrefslogtreecommitdiff
path: root/SnowFlake/SnowflakeId.java
diff options
context:
space:
mode:
authorqidaijie <[email protected]>2019-08-09 16:50:12 +0800
committerqidaijie <[email protected]>2019-08-09 16:50:12 +0800
commit0da2d582e046695456a148959bd9400662b3a70e (patch)
tree227015f3369eb0420c558ed7cb139a7ce1c2932f /SnowFlake/SnowflakeId.java
parent739c8fdb6e64d5a8771020f99100383cfad70694 (diff)
更新部分位置代码
Diffstat (limited to 'SnowFlake/SnowflakeId.java')
-rw-r--r--SnowFlake/SnowflakeId.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/SnowFlake/SnowflakeId.java b/SnowFlake/SnowflakeId.java
index e697202..5f77996 100644
--- a/SnowFlake/SnowflakeId.java
+++ b/SnowFlake/SnowflakeId.java
@@ -105,11 +105,12 @@ public class SnowflakeId {
if (tmpWorkerId > maxWorkerId || tmpWorkerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
- if (FlowWriteConfig.DATA_CENTER_ID_NUM > maxDataCenterId || FlowWriteConfig.DATA_CENTER_ID_NUM < 0) {
+ int dataCenterId = FlowWriteConfig.DATA_CENTER_ID_NUM;
+ if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDataCenterId));
}
this.workerId = tmpWorkerId;
- this.dataCenterId = FlowWriteConfig.DATA_CENTER_ID_NUM;
+ this.dataCenterId = dataCenterId;
}
// ==============================Methods==========================================