Home > Back-end >  Redis distributed lock RedisLockRegistry what reason no lock?
Redis distributed lock RedisLockRegistry what reason no lock?

Time:12-10

Code to cut:
//implementation method into A
The Lock Lock=RedisLockRegistry. Obtain (key)
if(! Lock. TryLock ()) {
//throw an exception
}
//business code

Objective: the key value, if get success continue to execute code lock, failed to get the lock throws an exception
Reality: interval for a period of time, no time will be the same key, all get the lock, the key two locks time difference about zero milliseconds (the difference between hours are not fixed),
Cause after all the same key for the lock the following business code execution,

What appear this kind of situation may be due to causes, from which aspects should I troubleshoot this problem
  • Related