@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)); }
@Override public boolean isInSafeMode(boolean useCache, String cluster) { if (useCache) { SafeModeCacheEntry safeModeCacheEntry = _clusterToSafeMode.get(cluster); if (safeModeCacheEntry != null && safeModeCacheEntry.isValid()) { return safeModeCacheEntry._safeMode; } } 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; } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } }
ZookeeperClusterStatus extends ClusterStatus { @Override public boolean isInSafeMode(boolean useCache, String cluster) { if (useCache) { SafeModeCacheEntry safeModeCacheEntry = _clusterToSafeMode.get(cluster); if (safeModeCacheEntry != null && safeModeCacheEntry.isValid()) { return safeModeCacheEntry._safeMode; } } 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; } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
ZookeeperClusterStatus extends ClusterStatus { @Override public boolean isInSafeMode(boolean useCache, String cluster) { if (useCache) { SafeModeCacheEntry safeModeCacheEntry = _clusterToSafeMode.get(cluster); if (safeModeCacheEntry != null && safeModeCacheEntry.isValid()) { return safeModeCacheEntry._safeMode; } } 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; } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } } ZookeeperClusterStatus(ZooKeeper zooKeeper, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(ZooKeeper zooKeeper);  ZookeeperClusterStatus(String connectionStr); }
ZookeeperClusterStatus extends ClusterStatus { @Override public boolean isInSafeMode(boolean useCache, String cluster) { if (useCache) { SafeModeCacheEntry safeModeCacheEntry = _clusterToSafeMode.get(cluster); if (safeModeCacheEntry != null && safeModeCacheEntry.isValid()) { return safeModeCacheEntry._safeMode; } } 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; } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } } ZookeeperClusterStatus(ZooKeeper zooKeeper, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(ZooKeeper zooKeeper);  ZookeeperClusterStatus(String connectionStr); @Override List<String> getClusterList(boolean useCache); @Override List<String> getOnlineControllerList(); @Override List<String> getControllerServerList(); @Override List<String> getOnlineShardServers(boolean useCache, String cluster); @Override List<String> getShardServerList(String cluster); @Override boolean exists(boolean useCache, String cluster, String table); @Override boolean isEnabled(boolean useCache, String cluster, String table); @Override TableDescriptor getTableDescriptor(boolean useCache, String cluster, String table); @Override List<String> getTableList(boolean useCache, String cluster); void close(); @Override String getCluster(boolean useCache, String table); @Override boolean isInSafeMode(boolean useCache, String cluster); @Override boolean isReadOnly(boolean useCache, String cluster, String table); @Override void createTable(TableDescriptor tableDescriptor); @Override void disableTable(String cluster, String table); @Override void enableTable(String cluster, String table); @Override void removeTable(String cluster, String table, boolean deleteIndexFiles); @Override boolean isOpen(); @Override void registerActionOnTableStateChange(Action action); }
ZookeeperClusterStatus extends ClusterStatus { @Override public boolean isInSafeMode(boolean useCache, String cluster) { if (useCache) { SafeModeCacheEntry safeModeCacheEntry = _clusterToSafeMode.get(cluster); if (safeModeCacheEntry != null && safeModeCacheEntry.isValid()) { return safeModeCacheEntry._safeMode; } } 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; } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } } ZookeeperClusterStatus(ZooKeeper zooKeeper, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration, Configuration config);  ZookeeperClusterStatus(ZooKeeper zooKeeper);  ZookeeperClusterStatus(String connectionStr); @Override List<String> getClusterList(boolean useCache); @Override List<String> getOnlineControllerList(); @Override List<String> getControllerServerList(); @Override List<String> getOnlineShardServers(boolean useCache, String cluster); @Override List<String> getShardServerList(String cluster); @Override boolean exists(boolean useCache, String cluster, String table); @Override boolean isEnabled(boolean useCache, String cluster, String table); @Override TableDescriptor getTableDescriptor(boolean useCache, String cluster, String table); @Override List<String> getTableList(boolean useCache, String cluster); void close(); @Override String getCluster(boolean useCache, String table); @Override boolean isInSafeMode(boolean useCache, String cluster); @Override boolean isReadOnly(boolean useCache, String cluster, String table); @Override void createTable(TableDescriptor tableDescriptor); @Override void disableTable(String cluster, String table); @Override void enableTable(String cluster, String table); @Override void removeTable(String cluster, String table, boolean deleteIndexFiles); @Override boolean isOpen(); @Override void registerActionOnTableStateChange(Action action); static final String CACHE; static final String COMPLETE; static final String INPROGRESS; static final String NEW; }