Examples of ZooKeeperWatcherBase


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

    /**
     * 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

                return -1;
            }

            ZooKeeper zk = null;
            try {
                ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(bkConf.getZkTimeout());
                zk = ZkUtils.createConnectedZookeeperClient(bkConf.getZkServers(), w);
                LedgerManagerFactory mFactory = LedgerManagerFactory.newLedgerManagerFactory(bkConf, zk);
                LedgerManager m = mFactory.newLedgerManager();
                ReadMetadataCallback cb = new ReadMetadataCallback(lid);
                m.readLedgerMetadata(lid, cb);
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

                .getLocalAddress().getPort() == newAuditor.getLocalAddress()
                .getPort());
    }

    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

     * @return zk client instance
     */
    private ZooKeeper newZookeeper(final String zkServers,
            final int sessionTimeout) throws IOException, InterruptedException,
            KeeperException {
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout()) {
            @Override
            public void process(WatchedEvent event) {
                // Check for expired connection.
                if (event.getState().equals(Watcher.Event.KeeperState.Expired)) {
                    LOG.error("ZK client connection to the ZK server has expired!");
View Full Code Here

Examples of org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase

            .setAllowLoopback(true)
            .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

        ServerConfiguration conf = new ServerConfiguration(bsConfs.get(0));
        conf.setAllowLoopback(true);
        conf.setAuditorPeriodicBookieCheckInterval(CHECK_INTERVAL);
        String addr = StringUtils.addrToString(bs.get(0).getLocalAddress());

        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(10000);
        auditorZookeeper = ZkUtils.createConnectedZookeeperClient(
                zkUtil.getZooKeeperConnectString(), w);

        auditorElector = new AuditorElector(addr, conf,
                auditorZookeeper);
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

     * @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

    public AutoRecoveryMain(ServerConfiguration conf) throws IOException,
            InterruptedException, KeeperException, UnavailableException,
            CompatibilityException {
        this.conf = conf;
        ZooKeeperWatcherBase w = new ZooKeeperWatcherBase(conf.getZkTimeout()) {
            @Override
            public void process(WatchedEvent event) {
                // Check for expired connection.
                if (event.getState().equals(Watcher.Event.KeeperState.Expired)) {
                    LOG.error("ZK client connection to the"
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.