Examples of ChildData


Examples of org.apache.curator.framework.recipes.cache.ChildData

        apiCache.getListenable().addListener(new PathChildrenCacheListener() {
            @Override
            public void childEvent(CuratorFramework curatorFramework, PathChildrenCacheEvent event) throws Exception {
                try {
                    LOG.debug("event: " + event);
                    ChildData childData = event.getData();
                    if (childData != null) {
                        PathChildrenCacheEvent.Type eventType = event.getType();
                        byte[] data = childData.getData();
                        LOG.info("Got childEvent " + eventType + " " + childData);
                        if (isValidData(data)) {
                            loadData(curatorFramework, eventType, data);
                        } else {
                            // do we have any children?
                            String path1 = childData.getPath();
                            List<String> names = curatorFramework.getChildren().forPath(path1);
                            for (String name : names) {
                                String fullPath = path1 + "/" + name;
                                data = curatorFramework.getData().forPath(fullPath);
                                if (isValidData(data)) {
View Full Code Here

Examples of org.apache.curator.framework.recipes.cache.ChildData

            }
        }
    }

    protected void treeCacheEvent(PathChildrenCacheEvent event) {
        ChildData childData = event.getData();
        if (childData == null) {
            return;
        }
        String path = childData.getPath();
        PathChildrenCacheEvent.Type type = event.getType();
        byte[] data = childData.getData();
        if (data == null || data.length == 0 || path == null) {
            return;
        }
        if (path.startsWith(zkPath)) {
            path = path.substring(zkPath.length());
View Full Code Here

Examples of org.apache.curator.framework.recipes.cache.ChildData

        return allChildren;
    }


    public static byte[] getByteData(TreeCache cache, String path) throws Exception {
        ChildData cacheData = cache.getCurrentData(path);
        if (cacheData != null) {
            return cacheData.getData();
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.curator.framework.recipes.cache.ChildData

    public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception {
        if (isValid()) {

            // guard against events with null data or path
            String path;
            ChildData childData = event.getData();
            if (childData != null) {
                path = childData.getPath();
            } else {
                path = null;
            }

            byte[] data = null;
            if (childData != null) {
                data = childData.getData();
            }

            PathChildrenCacheEvent.Type type = event.getType();
            switch (type) {
                case CHILD_ADDED:
View Full Code Here

Examples of org.apache.curator.framework.recipes.cache.ChildData

        }
    }

    protected void treeCacheEvent(PathChildrenCacheEvent event) {

        ChildData childData = event.getData();
        if (childData == null) {
            return;
        }
        String path = childData.getPath();
        PathChildrenCacheEvent.Type type = event.getType();
        byte[] data = childData.getData();
        if (data == null || data.length == 0 || path == null) {
            return;
        }
        if (path.startsWith(zkPath)) {
            path = path.substring(zkPath.length());
View Full Code Here

Examples of org.apache.curator.framework.recipes.cache.ChildData

    @Override
    public LoadedInstanceConfig loadConfig() throws Exception
    {
        int         version = -1;
        Properties  properties = new Properties();
        ChildData   childData = getConfigNode();
        if ( childData != null )
        {
            version = childData.getStat().getVersion();
            properties.load(new ByteArrayInputStream(childData.getData()));
        }
        PropertyBasedInstanceConfig config = new PropertyBasedInstanceConfig(properties, defaults);
        return new LoadedInstanceConfig(config, version);
    }
View Full Code Here

Examples of reddit.json.ChildData

                    System.out.println("Downloading [fetched " + linkBatch.size() + " links]");

                    for (ResponseChildData link : linkBatch)
                    {
                        ChildData data = link.getData();

                        /* Get link and title */
                        String url = data.getUrl();
                        String title = data.getTitle().replaceAll("/", " ");
                        String subreddit = data.getSubreddit();

                        if (!subreddits.contains(subreddit))
                            continue;

                        Thread t = new Thread(new Downloader(conf, loader, url, title, new IDownloadCallback() {
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.