Package at.salzburgresearch.nodekeeper.exception

Examples of at.salzburgresearch.nodekeeper.exception.NodeKeeperException


    public void startListeners() throws InterruptedException, NodeKeeperException, IOException {
        try {
            deleteRemoved();
            appendWatcherToSubnodes(startNode);
        } catch (KeeperException e) {
            throw new NodeKeeperException("cannot append listeners");
        }
    }
View Full Code Here


                            case NodeDeleted:
                                listener.onNodeDeleted(new Node(path));
                                removeStatus(path);
                                break;
                        }
                    } else throw new NodeKeeperException(String.format("cannot handle type %s",listener.getType()));
                }
            }
        }
    }
View Full Code Here

                    byte[] data = zk.getData(path,false,stat);
                    return new Node(path,handlers.get(clazz).parse(data),stat.getVersion());
                }
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException("cannot read node");
        }
        return null;
    }
View Full Code Here

                    buildRecursively(path.substring(0,path.lastIndexOf(PATH_SEPARATOR)),data);
                }
                zk.create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("error while creating node '#s'", path));
        }
    }
View Full Code Here

            if((stat=zk.exists(node.getPath(),false))!=null) {
                if(handlers.containsKey(clazz)) {
                    //set this node
                    zk.setData(node.getPath(), handlers.get(clazz).serialize(node.getData()),stat.getVersion());
                } else {
                    throw new NodeKeeperException(String.format("cannot find handler for '%s'",node.getData().getClass().getName()));
                }
            } else {
                //create all node parent recursively if necessary
                if(node.getPath().contains(PATH_SEPARATOR) && node.getPath().lastIndexOf(PATH_SEPARATOR)>0) {
                    buildRecursively(node.getPath().substring(0, node.getPath().lastIndexOf(PATH_SEPARATOR)), String.format("created by %s", this.getClass().getName()).getBytes());
                }
                //serialize data
                if(handlers.containsKey(clazz)) {
                    //create this node
                    zk.create(node.getPath(), handlers.get(clazz).serialize(node.getData()), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
                } else {
                    throw new NodeKeeperException(String.format("cannot find handler for '%s'",node.getData().getClass().getName()));
                }
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot write data for node '%s'", node.getPath()));
        }
    }
View Full Code Here

            Stat stat;
            if((stat=zk.exists(node.getPath(),false))!=null) {
                zk.delete(node.getPath(),stat.getVersion());
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot delete node '%s'", node.getPath()));
        }
    }
View Full Code Here

                Node<T> node = readNode(path.equals("/") ? path+key : path+PATH_SEPARATOR+key, clazz);
                if(node != null) nodes.add(node);
            }
            return nodes;
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot read children for '%s'", path));
        } catch (IOException e) {
            throw new NodeKeeperException(String.format("cannot read children for '%s'", path));
        }
    }
View Full Code Here

        try {
            connectedSignal.await(sessionTimeout, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new NodeKeeperException("cannot connect to zookeeper host "+connectionString);
        }

        log.info(" - nodekeeper initialized");

        if(reconnect) startListeners();
View Full Code Here

    public void startListeners() throws InterruptedException, NodeKeeperException, IOException {
        try {
            deleteRemoved();
            appendWatcherToSubnodes(startNode);
        } catch (KeeperException e) {
            throw new NodeKeeperException("cannot append listeners");
        }
    }
View Full Code Here

                                break;
                            case NodeDeleted:
                                listener.onNodeDeleted(new Node(path));
                                break;
                        }
                    } else throw new NodeKeeperException(String.format("cannot handle type %s",listener.getType()));
                }
            }
        }
        if(version == Event.EventType.NodeDeleted)
            removeStatus(path);
View Full Code Here

TOP

Related Classes of at.salzburgresearch.nodekeeper.exception.NodeKeeperException

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.