Skip to content

Commit 5388379

Browse files
committed
long type bug.
1 parent 3cadf08 commit 5388379

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

txlcn-tm/src/main/java/com/codingapi/txlcn/tm/core/storage/redis/RedisStorage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ public long acquireMachineId(long machineMaxSize, long timeout) throws FastStora
236236
acquireGlobalXLock();
237237
stringRedisTemplate.opsForValue().setIfAbsent(REDIS_MACHINE_ID_MAP_PREFIX + "cur_id", "-1");
238238
for (int i = 0; i < machineMaxSize; i++) {
239-
int curId = Math.toIntExact(
240-
Objects.requireNonNull(
241-
stringRedisTemplate.opsForValue().increment(REDIS_MACHINE_ID_MAP_PREFIX + "cur_id", 1)));
239+
long curId = Objects.requireNonNull(
240+
stringRedisTemplate.opsForValue().increment(REDIS_MACHINE_ID_MAP_PREFIX + "cur_id", 1));
242241
if (curId > machineMaxSize) {
243242
stringRedisTemplate.opsForValue().set(REDIS_MACHINE_ID_MAP_PREFIX + "cur_id", "0");
244243
curId = 0;

0 commit comments

Comments
 (0)