Examples of IZkChildListener


Examples of org.I0Itec.zkclient.IZkChildListener

    private IZkChildListener                 processListener;

    public StageMonitor(Long pipelineId){
        super(pipelineId);

        processListener = new IZkChildListener() {

            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds != null) {
                    initStage(currentChilds);
                }
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

                ConcurrentMap<NotifyListener, IZkChildListener> listeners = zkListeners.get(url);
                if (listeners == null) {
                    zkListeners.putIfAbsent(url, new ConcurrentHashMap<NotifyListener, IZkChildListener>());
                    listeners = zkListeners.get(url);
                }
                IZkChildListener zkListener = listeners.get(listener);
                if (zkListener == null) {
                    listeners.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)), listener);
                                }
                            }
                        }
                    });
                    zkListener = listeners.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)), listener);
                    }
                }
            } else {
                List<String> providers = new ArrayList<String>();
                for (String path : toCategoriesPath(url)) {
                    ConcurrentMap<NotifyListener, IZkChildListener> listeners = zkListeners.get(url);
                    if (listeners == null) {
                        zkListeners.putIfAbsent(url, new ConcurrentHashMap<NotifyListener, IZkChildListener>());
                        listeners = zkListeners.get(url);
                    }
                    IZkChildListener zkListener = listeners.get(listener);
                    if (zkListener == null) {
                        listeners.putIfAbsent(listener, new IZkChildListener() {
                            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                                ZookeeperRegistry.this.notify(url, listener, toUrls(url, currentChilds));
                            }
                        });
                        zkListener = listeners.get(listener);
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    }

    protected void doUnsubscribe(URL url, NotifyListener listener) {
        ConcurrentMap<NotifyListener, IZkChildListener> listeners = zkListeners.get(url);
        if (listeners != null) {
            IZkChildListener zkListener = listeners.get(listener);
            if (zkListener != null) {
                zkClient.unsubscribeChildChanges(toUrlPath(url), zkListener);
            }
        }
    }
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    };
    client.subscribeStateChanges(stateChangeListener);
    boolean waitUntilConnected = client.waitUntilConnected(10000,
        TimeUnit.MILLISECONDS);
    System.out.println("Connected " + waitUntilConnected);
    IZkChildListener listener1 = new IZkChildListener()
    {

      @Override
      public void handleChildChange(String parentPath,
          List<String> currentChilds) throws Exception
      {
        System.out.println("listener 1 Change at path:" + parentPath);
      }
    };
    IZkChildListener listener2 = new IZkChildListener()
    {
      @Override
      public void handleChildChange(String parentPath,
          List<String> currentChilds) throws Exception
      {
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    private volatile List<InetSocketAddress> currentAddress = new ArrayList<InetSocketAddress>();
    private volatile InetSocketAddress       runningAddress = null;

    public ClusterNodeAccessStrategy(String destination, ZkClientx zkClient){
        this.zkClient = zkClient;
        childListener = new IZkChildListener() {

            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                initClusters(currentChilds);
            }
View Full Code Here

Examples of org.I0Itec.zkclient.IZkChildListener

    public static void checkNoAppAlreadyDeployed(ZkClient zkClient) {
        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 Process forkS4Node(int debugPort, String[] args, ZkClient zkClient, int waitTimeInSeconds,
            String clusterName) throws IOException, InterruptedException {

        final CountDownLatch signalNodeReady = new CountDownLatch(1);

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

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                if (currentChilds.size() == 1) {
                    signalNodeReady.countDown();
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

            System.out.println(parentPath + " path exists and will be deleted");
            zkClient.deleteRecursive(parentPath);
        }
        zkClient.createPersistent(parentPath);
        final CountDownLatch signalReady = new CountDownLatch(1);
        zkClient.subscribeChildChanges(parentPath, new IZkChildListener() {

            @Override
            public void handleChildChange(String arg0, List<String> arg1) throws Exception {

                if (parentPath.equals(arg0)) {
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.