Add test for expiration before release in RedissonPermitExpirableSemaphore

Signed-off-by: Erhan Ceran <erhanceran@yahoo.com>
pull/4091/head
Erhan Ceran 3 years ago
parent 3c3e49e985
commit b1ca5cde93

@ -220,6 +220,16 @@ public class RedissonPermitExpirableSemaphoreTest extends BaseConcurrentTest {
});
}
@Test
public void testReleaseExpired() throws InterruptedException {
RPermitExpirableSemaphore s = redisson.getPermitExpirableSemaphore("test");
s.trySetPermits(1);
String permitId = s.tryAcquire(100, 100, TimeUnit.MILLISECONDS);
Thread.sleep(200);
boolean released = s.tryRelease(permitId);
assertThat(released).isFalse();
}
@Test
public void testConcurrency_SingleInstance() throws InterruptedException {
final AtomicInteger lockedCounter = new AtomicInteger();

Loading…
Cancel
Save