Package org.voltcore.zk.ZKUtil

Examples of org.voltcore.zk.ZKUtil.ByteArrayCallback


        newChildren.removeAll(m_lastChildren);
        m_lastChildren = children;

        List<ByteArrayCallback> callbacks = new ArrayList<ByteArrayCallback>();
        for (String child : children) {
            ByteArrayCallback cb = new ByteArrayCallback();
            // set watches on new children.
            if(newChildren.contains(child)) {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), m_childWatch, cb, null);
            } else {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), false, cb, null);
View Full Code Here


     * Update a modified child and republish a new snapshot. This may indicate
     * a deleted child or a child with modified data.
     */
    private void processChildEvent(WatchedEvent event) throws Exception {
        HashMap<String, JSONObject> cacheCopy = new HashMap<String, JSONObject>(m_publicCache.get());
        ByteArrayCallback cb = new ByteArrayCallback();
        m_zk.getData(event.getPath(), m_childWatch, cb, null);
        try {
            byte payload[] = cb.getData();
            JSONObject jsObj = new JSONObject(new String(payload, "UTF-8"));
            cacheCopy.put(cb.getPath(), jsObj);
        } catch (KeeperException.NoNodeException e) {
            cacheCopy.remove(event.getPath());
        }
        m_publicCache.set(ImmutableMap.copyOf(cacheCopy));
        if (m_cb != null) {
View Full Code Here

        newChildren.removeAll(m_lastChildren);
        m_lastChildren = children;

        List<ByteArrayCallback> callbacks = new ArrayList<ByteArrayCallback>();
        for (String child : children) {
            ByteArrayCallback cb = new ByteArrayCallback();
            // set watches on new children.
            if(newChildren.contains(child)) {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), m_childWatch, cb, null);
            } else {
                m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), false, cb, null);
View Full Code Here

     * Update a modified child and republish a new snapshot. This may indicate
     * a deleted child or a child with modified data.
     */
    private void processChildEvent(WatchedEvent event) throws Exception {
        HashMap<Integer, Long> cacheCopy = new HashMap<Integer, Long>(m_publicCache);
        ByteArrayCallback cb = new ByteArrayCallback();
        m_zk.getData(event.getPath(), m_childWatch, cb, null);
        try {
            // cb.getData() and cb.getPath() throw KeeperException
            byte payload[] = cb.getData();
            long HSId = Long.valueOf(new String(payload, "UTF-8"));
            cacheCopy.put(getPartitionIdFromZKPath(cb.getPath()), HSId);
        } catch (KeeperException.NoNodeException e) {
            // rtb: I think result's path is the same as cb.getPath()?
            cacheCopy.remove(getPartitionIdFromZKPath(event.getPath()));
        }
        m_publicCache = ImmutableMap.copyOf(cacheCopy);
View Full Code Here

TOP

Related Classes of org.voltcore.zk.ZKUtil.ByteArrayCallback

Copyright © 2018 www.massapicom. 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.