Package com.hazelcast.core

Examples of com.hazelcast.core.MultiMap.tryLock()


    @Test
    public void testTryLock() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
        Object key = "key";
        assertTrue(mm.tryLock(key));
    }

    @Test(expected = NullPointerException.class)
    public void testTryLock_whenNullKey() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
View Full Code Here


    }

    @Test(expected = NullPointerException.class)
    public void testTryLock_whenNullKey() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
        mm.tryLock(null);
    }

    @Test
    public void testTryLock_whenLockedBySelf() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
View Full Code Here

    @Test
    public void testTryLock_whenLockedBySelf() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
        final Object key = "Key";
        mm.lock(key);
        assertTrue(mm.tryLock(key));
    }

    @Test
    public void testTryLock_whenLockedByOther() throws Exception {
        final MultiMap mm = client.getMultiMap(randomString());
View Full Code Here

        final Object key = "Key1";
        mm.lock(key);
        final CountDownLatch tryLockFailed = new CountDownLatch(1);
        new Thread() {
            public void run() {
                if (mm.tryLock(key) == false) {
                    tryLockFailed.countDown();
                }
            }
        }.start();
        assertOpenEventually(tryLockFailed);
View Full Code Here

        final CountDownLatch tryLockReturnsTrue = new CountDownLatch(1);
        new Thread(){
            public void run() {
                try {
                    if(mm.tryLock(key, 10, TimeUnit.SECONDS)){
                        tryLockReturnsTrue.countDown();
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
View Full Code Here

        mm.lock(key, 2, TimeUnit.SECONDS);
        final CountDownLatch tryLockSuccess = new CountDownLatch(1);
        new Thread() {
            public void run() {
                try {
                    if (mm.tryLock(key, 4, TimeUnit.SECONDS)) {
                        tryLockSuccess.countDown();
                    }
                } catch (InterruptedException e) {
                    fail(e.getMessage());
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.