Revert back to use CyclicBarrier instead of CountDownLatch

pull/509/head
jackygurui 9 years ago
parent 799de99837
commit 02f30093ca

@ -235,13 +235,12 @@ public class RedissonSemaphoreTest extends BaseConcurrentTest {
s.setPermits(10);
final AtomicInteger checkPermits = new AtomicInteger(s.availablePermits());
final CountDownLatch latch = new CountDownLatch(s.availablePermits());
final CyclicBarrier barrier = new CyclicBarrier(s.availablePermits());
testMultiInstanceConcurrencySequentiallyLaunched(iterations, r -> {
RSemaphore s1 = r.getSemaphore("test");
try {
s1.acquire();
latch.countDown();
latch.await();
barrier.await();
if (checkPermits.decrementAndGet() > 0) {
assertThat(s1.availablePermits()).isEqualTo(0);
assertThat(s1.tryAcquire()).isFalse();
@ -251,6 +250,9 @@ public class RedissonSemaphoreTest extends BaseConcurrentTest {
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (BrokenBarrierException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int value = lockedCounter.get();
lockedCounter.set(value + 1);

Loading…
Cancel
Save