提交 f01fd082 编写于 作者: N Nikita Koksharov

refactoring

上级 a813ef69
...@@ -189,15 +189,6 @@ public class RedissonFairLockTest extends BaseConcurrentTest { ...@@ -189,15 +189,6 @@ public class RedissonFairLockTest extends BaseConcurrentTest {
assertThat(System.currentTimeMillis() - startTime).isBetween(2990L, 3100L); assertThat(System.currentTimeMillis() - startTime).isBetween(2990L, 3100L);
} }
@Test
public void testDelete() {
RLock lock = redisson.getFairLock("lock");
Assert.assertFalse(lock.delete());
lock.lock();
Assert.assertTrue(lock.delete());
}
@Test @Test
public void testForceUnlock() { public void testForceUnlock() {
RLock lock = redisson.getFairLock("lock"); RLock lock = redisson.getFairLock("lock");
......
...@@ -30,15 +30,6 @@ public class RedissonLockTest extends BaseConcurrentTest { ...@@ -30,15 +30,6 @@ public class RedissonLockTest extends BaseConcurrentTest {
assertThat(System.currentTimeMillis() - startTime).isBetween(2990L, 3100L); assertThat(System.currentTimeMillis() - startTime).isBetween(2990L, 3100L);
} }
@Test
public void testDelete() {
RLock lock = redisson.getLock("lock");
Assert.assertFalse(lock.delete());
lock.lock();
Assert.assertTrue(lock.delete());
}
@Test @Test
public void testForceUnlock() { public void testForceUnlock() {
RLock lock = redisson.getLock("lock"); RLock lock = redisson.getLock("lock");
......
...@@ -324,13 +324,13 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest { ...@@ -324,13 +324,13 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest {
Assert.assertFalse(lock.writeLock().tryLock()); Assert.assertFalse(lock.writeLock().tryLock());
Assert.assertFalse(lock.writeLock().isLocked()); Assert.assertFalse(lock.writeLock().isLocked());
Assert.assertFalse(lock.writeLock().isHeldByCurrentThread()); Assert.assertFalse(lock.writeLock().isHeldByCurrentThread());
lock.writeLock().delete(); lock.writeLock().forceUnlock();
} }
@Test @Test
public void testMultiRead() throws InterruptedException { public void testMultiRead() throws InterruptedException {
final RReadWriteLock lock = redisson.getReadWriteLock("lock"); final RReadWriteLock lock = redisson.getReadWriteLock("lock");
Assert.assertFalse(lock.readLock().delete()); Assert.assertFalse(lock.readLock().forceUnlock());
final RLock readLock1 = lock.readLock(); final RLock readLock1 = lock.readLock();
readLock1.lock(); readLock1.lock();
...@@ -374,16 +374,7 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest { ...@@ -374,16 +374,7 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest {
Assert.assertFalse(lock.writeLock().isLocked()); Assert.assertFalse(lock.writeLock().isLocked());
Assert.assertFalse(lock.writeLock().isHeldByCurrentThread()); Assert.assertFalse(lock.writeLock().isHeldByCurrentThread());
Assert.assertTrue(lock.writeLock().tryLock()); Assert.assertTrue(lock.writeLock().tryLock());
lock.writeLock().delete(); lock.writeLock().forceUnlock();
}
@Test
public void testDelete() {
RReadWriteLock lock = redisson.getReadWriteLock("lock");
Assert.assertFalse(lock.readLock().delete());
lock.readLock().lock();
Assert.assertTrue(lock.readLock().delete());
} }
@Test @Test
...@@ -594,7 +585,7 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest { ...@@ -594,7 +585,7 @@ public class RedissonReadWriteLockTest extends BaseConcurrentTest {
lock.unlock(); lock.unlock();
} finally { } finally {
// clear scheduler // clear scheduler
lock.delete(); lock.forceUnlock();
} }
} }
......
...@@ -252,7 +252,7 @@ public class RedissonRedLockTest { ...@@ -252,7 +252,7 @@ public class RedissonRedLockTest {
t.start(); t.start();
t.join(1000); t.join(1000);
lockFirst.delete(); lockFirst.forceUnlock();
RedissonMultiLock lock = new RedissonRedLock(lock1, lock2, lock3); RedissonMultiLock lock = new RedissonRedLock(lock1, lock2, lock3);
lock.lock(); lock.lock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册