RedisLock implements Lock { @Override public void releaseLock(String lockId) { RLock lock = redisson.getLock(parseLockId(lockId)); try { lock.unlock(); } catch (IllegalMonitorStateException e) { } } @Inject  RedisLock(Redisson redisson, RedisLockConfiguration configuration); @Override void acquireLock(String lockId); @Override boolean acquireLock(String lockId, long timeToTry, TimeUnit unit); @Override boolean acquireLock(String lockId, long timeToTry, long leaseTime, TimeUnit unit); @Override void releaseLock(String lockId); @Override void deleteLock(String lockId);  }
@Test public void testReleaseLock() { redisson.getKeys().flushall(); String lockId = "abcd-1234"; boolean isLocked = redisLock.acquireLock(lockId, 1000, 10000, TimeUnit.MILLISECONDS); assertTrue(isLocked); redisLock.releaseLock(lockId); RLock lock = redisson.getLock(lockId); assertFalse(lock.isLocked()); }