//if there are multiple waiters, then only 1 waiter should be notified.
@Test(timeout = 60000)
public void testSignalWithMultipleWaiters() throws InterruptedException {
HazelcastInstance instance = createHazelcastInstance();
ILock lock = instance.getLock(randomString());
final ICondition condition = lock.newCondition(randomString());
final CountDownLatch latch = new CountDownLatch(10);
final CountDownLatch syncLatch = new CountDownLatch(3);
createThreadWaitsForCondition(latch, lock, condition, syncLatch).start();
createThreadWaitsForCondition(latch, lock, condition, syncLatch).start();
createThreadWaitsForCondition(latch, lock, condition, syncLatch).start();
syncLatch.await();
lock.lock();
condition.signal();
lock.unlock();
assertTrueDelayed5sec(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(9, latch.getCount());
}
});
assertEquals(false, lock.isLocked());
}