1
0
mirror of synced 2025-12-08 06:08:13 +08:00

auto commit

This commit is contained in:
zhouzj
2021-03-23 01:52:00 +08:00
parent 2e414647cc
commit eec32633d7

View File

@@ -25,15 +25,13 @@ public class DefaultIdGenerator implements IIdGenerator {
throw new IdGeneratorException("BaseTime error.");
}
if (options.WorkerIdBitLength <= 0) {
throw new IdGeneratorException("WorkerIdBitLength error.(range:[1, 21])");
}
if (options.SeqBitLength + options.WorkerIdBitLength > 22) {
throw new IdGeneratorException("errorWorkerIdBitLength + SeqBitLength <= 22");
}
if (options.WorkerIdBitLength <= 0)
{
throw new IdGeneratorException("WorkerIdBitLength error.(range:[1, 21])");
}
double maxWorkerIdNumber = Math.pow(2, options.WorkerIdBitLength) - 1;
if (options.WorkerId < 0 || options.WorkerId > maxWorkerIdNumber) {
throw new IdGeneratorException("WorkerId error. (range:[0, " + (maxWorkerIdNumber > 0 ? maxWorkerIdNumber : 63) + "]");