Examples of ICountDownLatch


Examples of com.hazelcast.core.ICountDownLatch

        latch.trySetCount(-20);
    }

    @Test
    public void testTrySetCount_whenCountIsNotZero() {
        ICountDownLatch latch = hz.getCountDownLatch(randomString());
        latch.trySetCount(10);
        assertFalse(latch.trySetCount(20));
        assertFalse(latch.trySetCount(0));
        assertEquals(10, latch.getCount());
    }
View Full Code Here

Examples of com.hazelcast.core.ICountDownLatch

    // Generate the list of actions per DNode
    Map<String, List<DeployAction>> actionsPerDNode = generateDeployActionsPerDNode(deployRequests,
        version);

    // Starting the countdown latch.
    ICountDownLatch countDownLatchForDeploy = context.getCoordinationStructures()
        .getCountDownLatchForDeploy(version);
    Set<String> dnodesInvolved = actionsPerDNode.keySet();
    countDownLatchForDeploy.trySetCount(dnodesInvolved.size());

    // Sending deploy signals to each DNode
    for(Map.Entry<String, List<DeployAction>> actionPerDNode : actionsPerDNode.entrySet()) {
      DNodeService.Client client = null;
      boolean renew = false;
View Full Code Here

Examples of com.hazelcast.core.ICountDownLatch

          + version + "]");
      CoordinationStructures.DEPLOY_IN_PROGRESS.incrementAndGet();

      try {
        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

Examples of com.hazelcast.core.ICountDownLatch

                  log.warn("Error deploying [" + deployActions + "] barrier + [" + version + "]", t);
                  abortDeploy(version, ExceptionUtils.getStackTrace(t));
                } finally {
                  // Decrement the countdown latch. On 0, deployer knows that the deploy
                  // finished.
                  ICountDownLatch countdown = coord.getCountDownLatchForDeploy(version);
                  countdown.countDown();
                }
              }
            });
            try {
              // This line makes the wait thread wait for the deploy as long as the configuration tells
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.