From 7c1082ca714b58ef0ce87cd919bf1e3e987a6858 Mon Sep 17 00:00:00 2001 From: Zihlu Wang Date: Tue, 1 Aug 2023 19:02:28 +0800 Subject: [PATCH] style(guid): The constructor parameters order of SnowflakeGuidCreator has been adjusted. BREAKING CHANGE: Original order: long startEpoch, long workerId, long dataCentreId New order: long workerId, long dataCentreId, long startEpoch --- .../java/cn/org/codecrafters/guid/SnowflakeGuidCreator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guid/src/main/java/cn/org/codecrafters/guid/SnowflakeGuidCreator.java b/guid/src/main/java/cn/org/codecrafters/guid/SnowflakeGuidCreator.java index 073997a..878575f 100644 --- a/guid/src/main/java/cn/org/codecrafters/guid/SnowflakeGuidCreator.java +++ b/guid/src/main/java/cn/org/codecrafters/guid/SnowflakeGuidCreator.java @@ -103,7 +103,7 @@ public final class SnowflakeGuidCreator implements GuidCreator { * @param dataCentreId the data center ID (between 0 and 31). */ public SnowflakeGuidCreator(long workerId, long dataCentreId) { - this(DEFAULT_CUSTOM_EPOCH, workerId, dataCentreId); + this(workerId, dataCentreId, DEFAULT_CUSTOM_EPOCH); } /** @@ -118,7 +118,7 @@ public final class SnowflakeGuidCreator implements GuidCreator { * current timestamp, or if the worker ID * or data center ID is out of range */ - public SnowflakeGuidCreator(long startEpoch, long workerId, long dataCentreId) { + public SnowflakeGuidCreator(long workerId, long dataCentreId, long startEpoch) { if (startEpoch > currentTimestamp()) { throw new IllegalArgumentException("Start Epoch can not be greater than current timestamp!"); }