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