Package org.apache.blur.zookeeper

Examples of org.apache.blur.zookeeper.ZooKeeperLockManager


    }
    long s = System.nanoTime();
    try {
      checkIfOpen();
      String safemodePath = ZookeeperPathConstants.getSafemodePath(cluster);
      ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(_zk, safemodePath);
      if (zooKeeperLockManager.getNumberOfLockNodesPresent(cluster) == 0) {
        _clusterToSafeMode.put(cluster, new SafeModeCacheEntry(false));
        return false;
      }
      return true;
    } catch (KeeperException e) {
View Full Code Here


      if (newest == -1 || l > newest) {
        newest = l;
      }
    }
    assertTrue("newest [" + newest + "] oldest [" + oldest + "]", (newest - oldest) < TimeUnit.SECONDS.toMillis(5));
    ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(zk, "/testing/safemode");
    Thread.sleep(5000);
    assertEquals(0, zooKeeperLockManager.getNumberOfLockNodesPresent(SafeMode.STARTUP));
  }
View Full Code Here

    _cluster = cluster;
    _storagePath = ZookeeperPathConstants.getShardLayoutPath(cluster);
    _locksStoragePath = ZookeeperPathConstants.getShardLayoutPathLocks(cluster);
    ZkUtils.mkNodesStr(_zooKeeper, _storagePath);
    ZkUtils.mkNodesStr(_zooKeeper, _locksStoragePath);
    _zooKeeperLockManager = new ZooKeeperLockManager(_zooKeeper, _locksStoragePath);
  }
View Full Code Here

  }

  @Test
  public void testSafeModeNoCache() throws KeeperException, InterruptedException {
    String safemodePath = ZookeeperPathConstants.getSafemodePath(DEFAULT);
    ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(zooKeeper1, safemodePath);
    zooKeeperLockManager.lock(DEFAULT);
    assertTrue(clusterStatus2.isInSafeMode(false, DEFAULT));
    zooKeeperLockManager.unlock(DEFAULT);
    assertFalse(clusterStatus2.isInSafeMode(false, DEFAULT));
  }
View Full Code Here

  }

  @Test
  public void testSafeModeCache() throws KeeperException, InterruptedException {
    String safemodePath = ZookeeperPathConstants.getSafemodePath(DEFAULT);
    ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(zooKeeper1, safemodePath);
    zooKeeperLockManager.lock(DEFAULT);
    new WaitForAnswerToBeCorrect(20L) {
      @Override
      public Object run() {
        return clusterStatus2.isInSafeMode(false, DEFAULT);
      }
    }.test(true);
    zooKeeperLockManager.unlock(DEFAULT);
    new WaitForAnswerToBeCorrect(20L) {
      @Override
      public Object run() {
        return clusterStatus2.isInSafeMode(false, DEFAULT);
      }
View Full Code Here

      if (newest == -1 || l > newest) {
        newest = l;
      }
    }
    assertTrue("newest [" + newest + "] oldest [" + oldest + "]", (newest - oldest) < TimeUnit.SECONDS.toMillis(5));
    ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(zk, "/testing/safemode");
    Thread.sleep(5000);
    assertEquals(0, zooKeeperLockManager.getNumberOfLockNodesPresent(SafeMode.STARTUP));
  }
View Full Code Here

      if (newest == -1 || l > newest) {
        newest = l;
      }
    }
    assertTrue("newest [" + newest + "] oldest [" + oldest + "]", (newest - oldest) < TimeUnit.SECONDS.toMillis(5));
    ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(zk, "/testing/safemode");
    Thread.sleep(5000);
    assertEquals(0, zooKeeperLockManager.getNumberOfLockNodesPresent(SafeMode.STARTUP));
  }
View Full Code Here

      }
    }
    try {
      checkIfOpen();
      String safemodePath = ZookeeperPathConstants.getSafemodePath(cluster);
      ZooKeeperLockManager zooKeeperLockManager = new ZooKeeperLockManager(_zk, safemodePath);
      if (zooKeeperLockManager.getNumberOfLockNodesPresent(cluster) == 0) {
        _clusterToSafeMode.put(cluster, new SafeModeCacheEntry(false));
        return false;
      }
      _clusterToSafeMode.put(cluster, new SafeModeCacheEntry(true));
      return true;
View Full Code Here

TOP

Related Classes of org.apache.blur.zookeeper.ZooKeeperLockManager

Copyright © 2018 www.massapicom. 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.