use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testTryLock.
@Test
public void testTryLock() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
Object key = "key";
assertTrue(mm.tryLock(key));
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testTryLock_whenNullKey.
@Test(expected = NullPointerException.class)
public void testTryLock_whenNullKey() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
mm.tryLock(null);
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testForceUnlock_whenKeyLockedTwiceByOther.
@Test
public void testForceUnlock_whenKeyLockedTwiceByOther() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "key";
mm.lock(key);
mm.lock(key);
final CountDownLatch forceUnlock = new CountDownLatch(1);
new Thread() {
public void run() {
mm.forceUnlock(key);
forceUnlock.countDown();
}
}.start();
assertOpenEventually(forceUnlock);
assertFalse(mm.isLocked(key));
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testUnLock_whenNullKey.
@Test(expected = NullPointerException.class)
public void testUnLock_whenNullKey() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
mm.unlock(null);
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testUnLock.
@Test
public void testUnLock() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "key";
mm.lock(key);
mm.unlock(key);
assertFalse(mm.isLocked(key));
}
Aggregations