com.veracode.was.utils.caching.redis.RedisLock中用于解锁的代码如下:
private void unlock(boolean silent) {
if (rlock.isLocked()) {
if (!rlock.isHeldByCurrentThread()) {
if (!silent) {
throw new RuntimeException("Not allowed to unlock from thread that does not own the lock");
} else {
LOG.info("Not allowed to unlock from thread that does not own the lock");
}
} else {
rlock.unlock();
}
} else {
LOG.info("Already unlocked. Unnecessary call to unlock()");
}
}
我们的某些锁无法通过条件:
if (!rlock.isHeldByCurrentThread())
因此,他们永远保持锁定状态。 有什么办法可以删除这些锁?