Examples of WatchChildren


Examples of org.apache.blur.zookeeper.WatchChildren

    watchForShardServerChanges();
  }

  private void watchForShardServerChanges() {
    ZookeeperPathConstants.getOnlineShardsPath(_cluster);
    _watchOnlineShards = new WatchChildren(_zookeeper, ZookeeperPathConstants.getOnlineShardsPath(_cluster))
        .watch(new OnChange() {
          private List<String> _prevOnlineShards = new ArrayList<String>();

          @Override
          public void action(List<String> onlineShards) {
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

      return newTables;
    }
  }

  private WatchChildren watchForClusters() {
    return new WatchChildren(_zk, ZookeeperPathConstants.getClustersPath()).watch(new Clusters());
  }
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

      LOG.debug("trace getOnlineShardServers took [" + (e - s) / 1000000.0 + " ms]");
    }
  }

  private void watchForOnlineShardNodes(final String cluster) {
    WatchChildren watch = new WatchChildren(_zk, ZookeeperPathConstants.getOnlineShardsPath(cluster))
        .watch(new OnChange() {
          @Override
          public void action(List<String> children) {
            _onlineShardsNodes.put(cluster, children);
          }
        });
    if (_onlineShardsNodesWatchers.putIfAbsent(cluster, watch) != null) {
      // There was already a watch created. Close the extra watcher.
      watch.close();
    }
  }
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

      _clusters.set(new HashSet<String>(clusters));
      for (String cluster : clusters) {
        if (!_tableWatchers.containsKey(cluster)) {
          String tablesPath = ZookeeperPathConstants.getTablesPath(cluster);
          ZkUtils.waitUntilExists(_zk, tablesPath);
          WatchChildren clusterWatcher = new WatchChildren(_zk, tablesPath).watch(new Tables(cluster));
          _tableWatchers.put(cluster, clusterWatcher);
        }
      }

      List<String> clustersToCloseAndRemove = new ArrayList<String>(clusters);
      clustersToCloseAndRemove.removeAll(_tableWatchers.keySet());
      for (String cluster : clustersToCloseAndRemove) {
        WatchChildren watcher = _tableWatchers.remove(cluster);
        if (watcher == null) {
          LOG.error("Error watcher is null [" + cluster + "] ");
        } else {
          watcher.close();
        }
      }
    }
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getOnlineControllersPath());
    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getClustersPath());
  }

  private void watchForClusterChanges() throws KeeperException, InterruptedException {
    _watchForClusters = new WatchChildren(_zookeeper, ZookeeperPathConstants.getClustersPath());
    _watchForClusters.watch(new OnChange() {
      @Override
      public void action(List<String> children) {
        for (String cluster : children) {
          try {
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

      we2.close();
    }
  }

  private void watch(String cluster, String path, ConcurrentMap<String, WatchChildren> map) {
    WatchChildren watchForTables = new WatchChildren(_zookeeper, path);
    watchForTables.watch(new OnChange() {
      @Override
      public void action(List<String> children) {
        LOG.info("Layout change.");
        updateLayout();
      }
    });

    if (map.putIfAbsent(cluster, watchForTables) != null) {
      watchForTables.close();
    }
  }
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

    checkTable(table);
    return _clusterStatus.isEnabled(true, _cluster, table);
  }

  private WatchChildren watchForShardServerChanges() {
    WatchChildren watchOnlineShards = new WatchChildren(_zookeeper,
        ZookeeperPathConstants.getOnlineShardsPath(_cluster));
    watchOnlineShards.watch(new OnChange() {
      private List<String> _prevOnlineShards = new ArrayList<String>();

      @Override
      public void action(List<String> onlineShards) {
        List<String> oldOnlineShards = _prevOnlineShards;
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getControllersPath());
    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getClustersPath());
  }

  private void watchForClusterChanges() throws KeeperException, InterruptedException {
    _watchForClusters = new WatchChildren(_zookeeper, ZookeeperPathConstants.getClustersPath());
    _watchForClusters.watch(new OnChange() {
      @Override
      public void action(List<String> children) {
        for (String cluster : new HashSet<String>(_distributedLayoutFactoryMap.keySet())) {
          if (!children.contains(cluster)) {
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

  private void watchTables(final String cluster, ConcurrentMap<String, WatchChildren> map) {
    String path = ZookeeperPathConstants.getTablesPath(cluster);
    if (map.containsKey(cluster)) {
      return;
    }
    WatchChildren watchForTableLayoutChanges = new WatchChildren(_zookeeper, path);
    watchForTableLayoutChanges.watch(new OnChange() {
      @Override
      public void action(List<String> children) {
        LOG.info("Layout change for cluster [{0}].", cluster);
        updateLayout(cluster);
      }
    });
    if (map.putIfAbsent(cluster, watchForTableLayoutChanges) != null) {
      watchForTableLayoutChanges.close();
    }
  }
View Full Code Here

Examples of org.apache.blur.zookeeper.WatchChildren

    String path = ZookeeperPathConstants.getTablePath(cluster, table);
    String key = cluster + "|" + table;
    if (map.containsKey(key)) {
      return;
    }
    WatchChildren watchForTableLayoutChanges = new WatchChildren(_zookeeper, path);
    watchForTableLayoutChanges.watch(new OnChange() {
      @Override
      public void action(List<String> children) {
        LOG.info("Layout change for cluster [{0}] table [{1}].", cluster, table);
        updateLayout(cluster);
      }
    });
    if (map.putIfAbsent(key, watchForTableLayoutChanges) != null) {
      watchForTableLayoutChanges.close();
    }
  }
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.