Examples of ConnectStringParser


Examples of org.apache.zookeeper.client.ConnectStringParser

    @Test
    public void testSingleServerChrootPath(){
        String chrootPath = "/hallo/welt";
        String servers = "10.10.10.1";
        assertChrootPath(chrootPath,
                new ConnectStringParser(servers+chrootPath));
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

    @Test
    public void testMultipleServersChrootPath(){
        String chrootPath = "/hallo/welt";
        String servers = "10.10.10.1,10.10.10.2";
        assertChrootPath(chrootPath,
                new ConnectStringParser(servers+chrootPath));
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

    }

    @Test
    public void testParseServersWithoutPort(){
        String servers = "10.10.10.1,10.10.10.2";
        ConnectStringParser parser = new ConnectStringParser(servers);

        Assert.assertEquals("10.10.10.1", parser.getServerAddresses().get(0).getHostName());
        Assert.assertEquals("10.10.10.2", parser.getServerAddresses().get(1).getHostName());
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

    }

    @Test
    public void testParseServersWithPort(){
        String servers = "10.10.10.1:112,10.10.10.2:110";
        ConnectStringParser parser = new ConnectStringParser(servers);

        Assert.assertEquals("10.10.10.1", parser.getServerAddresses().get(0).getHostName());
        Assert.assertEquals("10.10.10.2", parser.getServerAddresses().get(1).getHostName());

        Assert.assertEquals(112, parser.getServerAddresses().get(0).getPort());
        Assert.assertEquals(110, parser.getServerAddresses().get(1).getPort());
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

        LOG.info("Initiating client connection, connectString=" + connectString
                + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher);

        watchManager.defaultWatcher = watcher;

        ConnectStringParser connectStringParser = new ConnectStringParser(
                connectString);
        HostProvider hostProvider = new StaticHostProvider(
                connectStringParser.getServerAddresses());
        cnxn = new ClientCnxn(connectStringParser.getChrootPath(),
                hostProvider, sessionTimeout, this, watchManager,
                getClientCnxnSocket(), canBeReadOnly);
        cnxn.start();
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

                + " sessionPasswd="
                + (sessionPasswd == null ? "<null>" : "<hidden>"));

        watchManager.defaultWatcher = watcher;

        ConnectStringParser connectStringParser = new ConnectStringParser(
                connectString);
        HostProvider hostProvider = new StaticHostProvider(
                connectStringParser.getServerAddresses());
        cnxn = new ClientCnxn(connectStringParser.getChrootPath(),
                hostProvider, sessionTimeout, this, watchManager,
                getClientCnxnSocket(), sessionId, sessionPasswd, canBeReadOnly);
        cnxn.seenRwServerBefore = true; // since user has provided sessionId
        cnxn.start();
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

                    HostProvider hostProvider = (HostProvider) ReflectionUtils.getField(hostProviderField, cnxn);
                    List<InetSocketAddress> serverAddrs = (List<InetSocketAddress>) ReflectionUtils.getField(
                                                                                                             serverAddressesField,
                                                                                                             hostProvider);
                    // 添加第二组集群列表
                    serverAddrs.addAll(new ConnectStringParser(cluster).getServerAddresses());
                }
            }
        } catch (Exception e) {
            try {
                if (zk != null) {
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

    }

    @VisibleForTesting
    ResolvingEnsembleProvider(String connectString, Resolver resolver) {
        _resolver = resolver;
        _connectStringParser = new ConnectStringParser(connectString);
    }
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

     *            "/app/a/foo/bar" (from the server perspective).    
     *
     * @throws IOException in cases of network failure    
     */
    public void updateServerList(String connectString) throws IOException {
        ConnectStringParser connectStringParser = new ConnectStringParser(connectString);
        Collection<InetSocketAddress> serverAddresses = connectStringParser.getServerAddresses();

        ClientCnxnSocket clientCnxnSocket = cnxn.sendThread.getClientCnxnSocket();
        InetSocketAddress currentHost = (InetSocketAddress) clientCnxnSocket.getRemoteSocketAddress();

        boolean reconfigMode = hostProvider.updateServerList(serverAddresses, currentHost);
View Full Code Here

Examples of org.apache.zookeeper.client.ConnectStringParser

                + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher);

        watchManager = defaultWatchManager();
        watchManager.defaultWatcher = watcher;

        ConnectStringParser connectStringParser = new ConnectStringParser(
                connectString);
       
        hostProvider = new StaticHostProvider(
                connectStringParser.getServerAddresses());
        cnxn = new ClientCnxn(connectStringParser.getChrootPath(),
                hostProvider, sessionTimeout, this, watchManager,
                getClientCnxnSocket(), canBeReadOnly);
        cnxn.start();
    }
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.