...
|
...
|
@@ -24,6 +24,8 @@ public class PropMachineIdProvider implements MachineIdProvider { |
|
|
@Autowired
|
|
|
MachineIdGenerateMapper machineIdGenerateMapper;
|
|
|
|
|
|
CodeBitMeta codeBitMeta = new CodeBitMeta();
|
|
|
|
|
|
/**
|
|
|
* 默认的机器Id
|
|
|
* @return
|
...
|
...
|
@@ -89,7 +91,7 @@ public class PropMachineIdProvider implements MachineIdProvider { |
|
|
List<Integer> machineIds = machines.stream().map(MachineIdGenerate::getMachineId).collect(Collectors.toList());
|
|
|
|
|
|
Integer usableMachineId = null;
|
|
|
for (int i = 0; i< 32; i++){
|
|
|
for (int i = 0; i< (2<<codeBitMeta.getMachineBits()-1); i++){
|
|
|
if (!machineIds.contains(Integer.valueOf(i))){
|
|
|
usableMachineId = Integer.valueOf(i);
|
|
|
break;
|
...
|
...
|
|