GH-8803: RedisLockRegistry: Log for lock acquired
Fixes: #8803
Would be great to have an `Acquired lock; RedisLock...` logging message as we already have `Released lock; RedisLock ...`
* Improve `RedisLockRegistry.RedisLock.tryRedisLock()` to emit `Acquired lock; RedisLock...` debug message
**Cherry-pick to `6.0.x`**
(cherry picked from commit 9bd8001a61)
This commit is contained in:
committed by
Artem Bilan
parent
8c18dc553a
commit
ec707e71fa
@@ -84,6 +84,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Anton Gabov
|
||||
* @author Eddie Cho
|
||||
* @author Myeonghyeon Lee
|
||||
* @author Roman Zabaluev
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
@@ -421,11 +422,14 @@ public final class RedisLockRegistry implements ExpirableLockRegistry, Disposabl
|
||||
}
|
||||
|
||||
private boolean tryRedisLock(long time) throws ExecutionException, InterruptedException {
|
||||
final boolean result = tryRedisLockInner(time);
|
||||
if (result) {
|
||||
final boolean acquired = tryRedisLockInner(time);
|
||||
if (acquired) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Acquired lock; " + this);
|
||||
}
|
||||
this.lockedAt = System.currentTimeMillis();
|
||||
}
|
||||
return result;
|
||||
return acquired;
|
||||
}
|
||||
|
||||
protected final Boolean obtainLock() {
|
||||
|
||||
Reference in New Issue
Block a user