Radisson lock: I have applied a distributed lock and I am not sure what will happen if Redis goes down in AWS then the lock will never be released or is there a mechanism to do that?
Code snippet:
@Override
@Async
public Future<BaseResponse> someMethodAsync(){
Lock lock = redissonClient.getFairLock(getLockName());
if(lock.tryLock()){
//Do something
return new AsyncResult<>(resp);
}finally{
lock.unlock();
}
}
LockWatchdogTimeout
Default value: 30000
Lock watchdog timeout in milliseconds. This parameter is only used if the lock has been acquired without leaseTimeout parameter definition. The lock will be expired after lockWatchdogTimeout if watchdog didn't extend it to the next lockWatchdogTimeout time interval. This prevents against infinity locked locks due to Radisson client crush or any other reason when lock can't be released in a proper way.
Read here - https://github.com/redisson/redisson/wiki/2.-Configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With