The counter should start from 0. Otherwise, according to the program logic, even if the removethreadid method is called, the counter will not be reduced to 0.

Signed-off-by: why技术 <thisiswhy@outlook.com>
pull/4272/head
why技术 3 years ago
parent 9bb03cd5c1
commit 6ca90567cb

@ -57,7 +57,7 @@ public abstract class RedissonBaseLock extends RedissonExpirable implements RLoc
public synchronized void addThreadId(long threadId) {
threadIds.compute(threadId, (t, counter) -> {
counter = Optional.ofNullable(counter).orElse(1);
counter = Optional.ofNullable(counter).orElse(0);
counter++;
return counter;
});

Loading…
Cancel
Save