Package com.hazelcast.core

Examples of com.hazelcast.core.ILock.lock()


                }
            }
        }).start();

        sleepSeconds(1);
        lock.lock();
        condition.signal();
        lock.unlock();
    }

    @Test(timeout = 60000)
View Full Code Here


        HazelcastInstance instance = createHazelcastInstance();

        final ILock lock = instance.getLock(randomString());
        final ICondition condition = lock.newCondition(randomString());

        lock.lock();

        Date date = new Date();
        date.setTime(System.currentTimeMillis() + 1000);
        assertFalse(condition.awaitUntil(date));
    }
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(1);

        new Thread(new Runnable() {
            @Override
            public void run() {
                lock.lock();
                try {
                    Date date = new Date();
                    date.setTime(System.currentTimeMillis() + 10000);
                    if (condition.awaitUntil(date)) {
                        latch.countDown();
View Full Code Here

                }
            }
        }).start();

        sleepSeconds(1);
        lock.lock();
        condition.signal();
        lock.unlock();
    }

    // See #3262
View Full Code Here

        HazelcastInstance instance = createHazelcastInstance();

        final ILock lock = instance.getLock(randomString());
        final ICondition condition = lock.newCondition(randomString());

        lock.lock();

        assertFalse(condition.await(-1, TimeUnit.MILLISECONDS));
    }

    // ====================== tests to make sure the condition can deal with cluster member failure ====================
View Full Code Here

        Thread t = new Thread(new Runnable() {
            public void run() {
                ILock lock = instance2.getLock(key);
                ICondition condition = lock.newCondition(conditionName);
                lock.lock();
                try {
                    condition.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
View Full Code Here

                }
                lock.destroy();
            }
        }).start();

        lock.lock();
        latch.countDown();
        condition.await();
        lock.unlock();
    }
View Full Code Here

                }
                instance.shutdown();
            }
        }).start();

        lock.lock();
        try {
            latch.countDown();
            condition.await();
        } catch (InterruptedException e) {
        }
View Full Code Here

        final CountDownLatch awaitLatch = new CountDownLatch(size);
        final CountDownLatch finalLatch = new CountDownLatch(size);
        for (int i = 0; i < size; i++) {
            new Thread(new Runnable() {
                public void run() {
                    lock.lock();
                    try {
                        awaitLatch.countDown();
                        condition.await();
                        if (lock.isLockedByCurrentThread()) {
                            count.incrementAndGet();
View Full Code Here

        }

        ILock lock1 = keyOwner.getLock(key);
        ICondition condition1 = lock1.newCondition(name);
        awaitLatch.await(1, TimeUnit.MINUTES);
        lock1.lock();
        condition1.signalAll();
        lock1.unlock();
        keyOwner.shutdown();

        finalLatch.await(2, TimeUnit.MINUTES);
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.