@Test @Ignore public void testReentrantLock() throws InterruptedException { String res = "res1"; DLock lock = client.getLock(res); try { boolean success = lock.tryLock(5, 30, TimeUnit.SECONDS); System.out.println("key:"+res+" value:"+redisTemplate.get(res)); if (success) { System.out.println("re-entry:"+lock.tryLock(5, 30, TimeUnit.SECONDS)); System.out.println("Lock Success"); } else { System.out.println("Lock Failure"); } } finally { lock.unlock(); } System.out.println("key:"+res+" value:"+redisTemplate.get(res)); }
@Override public DLock getLock(String name) { return new RedisDistLock(UUIDUtils.getTrimId(), name, redisTemplate); }
DefaultLockClient implements LockClient { @Override public DLock getLock(String name) { return new RedisDistLock(UUIDUtils.getTrimId(), name, redisTemplate); } }
DefaultLockClient implements LockClient { @Override public DLock getLock(String name) { return new RedisDistLock(UUIDUtils.getTrimId(), name, redisTemplate); } DefaultLockClient(RedisTemplate redisTemplate); }
DefaultLockClient implements LockClient { @Override public DLock getLock(String name) { return new RedisDistLock(UUIDUtils.getTrimId(), name, redisTemplate); } DefaultLockClient(RedisTemplate redisTemplate); @Override DLock getLock(String name); }
DefaultLockClient implements LockClient { @Override public DLock getLock(String name) { return new RedisDistLock(UUIDUtils.getTrimId(), name, redisTemplate); } DefaultLockClient(RedisTemplate redisTemplate); @Override DLock getLock(String name);  }