Package com.hazelcast.core

Examples of com.hazelcast.core.ICountDownLatch.await()


        latch.trySetCount(1);
        for (int i = 0; i < 10; i++) {
            new TestThread() {
                public void doRun() throws Exception {
                    if (latch.await(1, TimeUnit.MINUTES)) {
                        completedLatch.countDown();
                    }
                }
            }.start();
        }
View Full Code Here


        HazelcastInstance instance = createHazelcastInstance();
        ICountDownLatch latch = instance.getCountDownLatch(randomString());

        latch.trySetCount(1);
        long time = System.currentTimeMillis();
        assertFalse(latch.await(100, TimeUnit.MILLISECONDS));
        long elapsed = System.currentTimeMillis() - time;
        assertTrue(elapsed >= 100);
        assertEquals(1, latch.getCount());
    }
View Full Code Here

        latch.trySetCount(10);

        final TestThread awaitThread = new TestThread() {
            @Override
            public void doRun() throws Exception {
                latch.await(1, TimeUnit.HOURS);
            }
        };
        awaitThread.start();

        // give the awaitthread some time to get in the waiting state
View Full Code Here

        long waitSeconds = 0;
        ICountDownLatch countDownLatchForDeploy = context.getCoordinationStructures()
            .getCountDownLatchForDeploy(version);
        boolean finished;
        do {
          finished = countDownLatchForDeploy.await(secondsToCheckFailureOrTimeout, TimeUnit.SECONDS);
          waitSeconds += secondsToCheckFailureOrTimeout;
          if(!finished) {
            // If any of the DNodes failed, then we cancel the deployment.
            if(checkForFailure()) {
              explainErrors();
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.