I am using Redisson with
RLock lock = redissonClient().getLock(key);
try {
if (lock.tryLock()) {
// Logic here
redissonClient().getMap().get("key"); // returns value
lock.unlock();
}
redissonClient().getMap().get("key"); // returns NULL
} catch (Exception e) {
LOG.error("Error..", e);
} finally {
if (lock != null && lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
LOG.debug("lock released");
}
}
If I don't use locks everything works as expected, but after unlock, the value returned is always null.