Examples of IZkChildListener


Examples of org.I0Itec.zkclient.IZkChildListener

    {
      String instanceName = "localhost_" + (12918 + i);
      String msgPath =
          PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, instanceName);

      _gZkClient.subscribeChildChanges(msgPath, new IZkChildListener()
      {

        @Override
        public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception
        {
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    final AtomicBoolean success = new AtomicBoolean(true);
    for (int i = 0; i < 5; i++) {
      String instanceName = "localhost_" + (12918 + i);
      String msgPath = PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, instanceName);

      _gZkClient.subscribeChildChanges(msgPath, new IZkChildListener() {

        @Override
        public void handleChildChange(String parentPath, List<String> currentChilds)
            throws Exception {
          if (currentChilds != null && currentChilds.size() > 1) {
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

            consumerStreamReady = false;
        }
        Assert.assertFalse(consumerStreamReady);
        final CountDownLatch signalConsumerReady = new CountDownLatch(1);

        zkClient.subscribeChildChanges("/s4/streams/tickStream/consumers", new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 1) {
                    signalConsumerReady.countDown();
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

        zkClient.setZkSerializer(new ZNRecordSerializer());
        List<String> processes = zkClient.getChildren("/s4/clusters/" + PRODUCER_CLUSTER + "/process");
        Assert.assertTrue(processes.size() == 0);
        final CountDownLatch signalProcessesReady = new CountDownLatch(1);

        zkClient.subscribeChildChanges("/s4/clusters/" + PRODUCER_CLUSTER + "/process", new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 1) {
                    signalProcessesReady.countDown();
                }

            }
        });

        zkClient.subscribeChildChanges("/s4/clusters/" + CONSUMER_CLUSTER + "/process", new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 1) {
                    signalProcessesReady.countDown();
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

        zkClient.setZkSerializer(new ZNRecordSerializer());
        List<String> processes = zkClient.getChildren("/s4/clusters/cluster1/process");
        Assert.assertTrue(processes.size() == 0);
        final CountDownLatch signalProcessesReady = new CountDownLatch(1);

        zkClient.subscribeChildChanges("/s4/clusters/cluster1/process", new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 2) {
                    signalProcessesReady.countDown();
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    public static CountDownLatch getConsumerReadySignal(String streamName) {
        final CountDownLatch signalAppReady = new CountDownLatch(1);

        ZkClient zkClient = new ZkClient("localhost:" + CoreTestUtils.ZK_PORT);
        // TODO check a proper app state variable. This is hacky
        zkClient.subscribeChildChanges("/s4/streams/" + streamName + "/consumers", new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 1) {
                    signalAppReady.countDown();
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    final GroupLeadershipSessionZkClientImpl groupLeadershipSession =
      new GroupLeadershipSessionZkClientImpl(baseZkPath,groupName, resolvedMemberName, acceptLeadershipCallback);

    //Create and set call backs for data and child changes;
    IZkChildListener childListener = new IZkChildListener()
    {
      @Override
      public void handleChildChange(String parentPath, List<String> currentChildren)
          throws Exception
      {
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    final AtomicBoolean success = new AtomicBoolean(true);
    for (int i = 0; i < 5; i++) {
      String instanceName = "localhost_" + (12918 + i);
      String msgPath = PropertyPathConfig.getPath(PropertyType.MESSAGES, clusterName, instanceName);

      _zkclient.subscribeChildChanges(msgPath, new IZkChildListener() {

        @Override
        public void handleChildChange(String parentPath, List<String> currentChilds)
            throws Exception {
          if (currentChilds != null && currentChilds.size() > 1) {
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

  }

  @SuppressWarnings("unchecked")
  protected Element<T> getFirstElement() throws InterruptedException {
    final Object mutex = new Object();
    IZkChildListener notifyListener = new IZkChildListener() {
      @Override
      public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
        synchronized (mutex) {
          mutex.notify();
        }
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    protected void doSubscribe(final URL url, final NotifyListener listener) {
        try {
            if (Constants.ANY_VALUE.equals(url.getServiceInterface())) {
                String root = toRootPath();
                IZkChildListener zkListener = zkListeners.get(listener);
                if (zkListener == null) {
                    zkListeners.putIfAbsent(listener, new IZkChildListener() {
                        public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                            for (String child : currentChilds) {
                                if (! anyServices.contains(child)) {
                                    anyServices.add(child);
                                    subscribe(url.setPath(child).addParameters(Constants.INTERFACE_KEY, child,
                                            Constants.CHECK_KEY, String.valueOf(false), Constants.REGISTER_KEY, String.valueOf(false)), listener);
                                }
                            }
                        }
                    });
                    zkListener = zkListeners.get(listener);
                }
                List<String> services = zkClient.subscribeChildChanges(root, zkListener);
                if (services != null && services.size() > 0) {
                    anyServices.addAll(services);
                    for (String service : services) {
                        subscribe(url.setPath(service).addParameters(Constants.INTERFACE_KEY, service,
                                Constants.CHECK_KEY, String.valueOf(false), Constants.REGISTER_KEY, String.valueOf(false)), listener);
                    }
                }
            } else {
                List<String> providers = new ArrayList<String>();
                for (String path : toCategoriesPath(url)) {
                    IZkChildListener zkListener = zkListeners.get(listener);
                    if (zkListener == null) {
                        zkListeners.putIfAbsent(listener, new IZkChildListener() {
                            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                                ZookeeperRegistry.this.notify(url, listener, toUrls(url, currentChilds));
                            }
                        });
                        zkListener = zkListeners.get(listener);
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.