Examples of ZooKeeperWatcherBase


Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

     *             Throws this exception if there is an error instantiating the
     *             BookKeeper client.
     */
    public BookKeeperAdmin(ClientConfiguration conf) throws IOException, InterruptedException, KeeperException {
        // Create the ZooKeeper client instance
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout());
        zk = ZkUtils.createConnectedZookeeperClient(conf.getZkServers(), w);
        // Create the bookie path
        bookiesPath = conf.getZkAvailableBookiesPath();
        // Create the BookKeeper client instance
        bkc = new BookKeeper(conf, zk);
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

                                               ClientBase.CONNECTION_TIMEOUT);
        LOG.debug("Server up: " + b);

        // create a zookeeper client
        LOG.debug("Instantiate ZK Client");
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        zkc = ZkUtils.createConnectedZookeeperClient(
                getZooKeeperConnectString(), w);

        // initialize the zk client with values
        zkc.create("/ledgers", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

     *            removed without prompt.
     * @return Returns true if format succeeds else false.
     */
    public static boolean format(ClientConfiguration conf,
            boolean isInteractive, boolean force) throws Exception {
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout());
        ZooKeeper zkc = ZkUtils.createConnectedZookeeperClient(
                conf.getZkServers(), w);
        BookKeeper bkc = null;
        try {
            boolean ledgerRootExists = null != zkc.exists(
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

     * @throws KeeperException
     */
    public BookKeeper(final ClientConfiguration conf)
            throws IOException, InterruptedException, KeeperException {
        this.conf = conf;
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout());
        this.zk = ZkUtils
                .createConnectedZookeeperClient(conf.getZkServers(), w);

        this.channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                Executors.newCachedThreadPool());
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

        conf = new ServerConfiguration().setZkServers(zkUtil.getZooKeeperConnectString());

        executor = Executors.newCachedThreadPool();

        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        zkc1 = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);
        w = new ZooKeeperWatcherBase(10000);
        zkc2 = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);
        lmf1 = LedgerManagerFactory.newLedgerManagerFactory(conf, zkc1);
        lmf2 = LedgerManagerFactory.newLedgerManagerFactory(conf, zkc2);
        basePath = conf.getZkLedgersRootPath() + '/'
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

        // Starte RW2
        int startNewBookie2 = startNewBookie();
        InetSocketAddress newBkAddr2 = new InetSocketAddress(InetAddress
                .getLocalHost().getHostAddress(), startNewBookie2);
        LOG.info("New Bookie addr :" + newBkAddr2);
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        ZooKeeper zkc1 = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);
        ReplicationWorker rw2 = new ReplicationWorker(zkc1, baseConf,
                newBkAddr2);
        rw1.start();
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

            ServerConfiguration conf = new ServerConfiguration(bsConfs.get(i));
            conf.setAuditorPeriodicCheckInterval(CHECK_INTERVAL);

            String addr = StringUtils.addrToString(bs.get(i).getLocalAddress());

            ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
            ZooKeeper zk = ZkUtils.createConnectedZookeeperClient(
                    zkUtil.getZooKeeperConnectString(), w);
            zkClients.add(zk);

            AuditorElector auditorElector = new AuditorElector(addr,
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

    /**
     * Test that the replication worker will shutdown if it lose its zookeeper session
     */
    @Test(timeout=30000)
    public void testRWZKSessionLost() throws Exception {
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        ZooKeeper zk = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);

        try {
            ReplicationWorker rw = new ReplicationWorker(zk, baseConf, getBookie(0));
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

            assertFalse("AuditorElector should have shutdown", e.isRunning());
        }
    }

    private void startAuditorElector(String addr) throws Exception {
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        ZooKeeper zk = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);
        zkClients.add(zk);

        AuditorElector auditorElector = new AuditorElector(addr,
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

     * List all the ledgers and check them individually. This should not
     * be run very often.
     */
    private void checkAllLedgers() throws BKAuditException, BKException,
            IOException, InterruptedException, KeeperException {
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout());
        ZooKeeper newzk = ZkUtils.createConnectedZookeeperClient(conf.getZkServers(), w);

        final BookKeeper client = new BookKeeper(new ClientConfiguration(conf),
                                                 newzk);
        final BookKeeperAdmin admin = new BookKeeperAdmin(client);
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.