1
0
mirror of synced 2026-04-12 20:18:56 +08:00

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Binary Wang
2026-03-21 16:25:24 +08:00
committed by GitHub
parent e9ac624022
commit 8ec7cb8e4b

View File

@@ -42,13 +42,17 @@ public class RedisTemplateSimpleDistributedLock implements Lock {
@Override @Override
public void lock() { public void lock() {
boolean interrupted = false;
while (!tryLock()) { while (!tryLock()) {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); interrupted = true;
} }
} }
if (interrupted) {
Thread.currentThread().interrupt();
}
} }
@Override @Override