Package com.netflix.loadbalancer

Examples of com.netflix.loadbalancer.Server


    }

    @Test
    public void pingFailTest() throws Exception {
        SuroPing ping = new SuroPing();
        Server server = new Server("localhost", 7901);
        assertEquals(false, ping.isAlive(server));
    }
View Full Code Here


    @Inject
    public StaticLoadBalancer(ClientConfig config) {
        List<Server> serverList = new ArrayList<Server>();
        for (String s : config.getLoadBalancerServer().split(",")) {
            String[] host_port = s.split(":");
            serverList.add(new Server(host_port[0], Integer.parseInt(host_port[1])));
        }
        if (serverList.isEmpty()) {
            throw new IllegalArgumentException("empty server list");
        }
View Full Code Here

        }

        if (config.getEnableOutPool()) {
            synchronized (this) {
                for (int i = 0; i < config.getRetryCount() && connection == null; ++i) {
                    Server server = lb.chooseServer(null);
                    if (server != null) {
                        connection = new SuroConnection(server, config, false);
                        try {
                            connection.connect();
                            ++outPoolSize;
View Full Code Here

    private SuroConnection chooseFromPool() {
        SuroConnection connection = null;
        int count = 0;

        while (connection == null) {
            Server server = lb.chooseServer(null);
            if (server != null) {
                if (!serverSet.contains(server)) {
                    newConnectionBuilder.execute(createNewConnection(server, true));
                } else {
                    connection = connectionPool.remove(server);
View Full Code Here

     * @param key can bel null
     * @return
     */
    @Override
    public Server chooseServer(Object key) {
        Server server = super.chooseServer(key);
        if (server == null) {
            return null;
        }
        server.setPort(port);

        return server;
    }
View Full Code Here

TOP

Related Classes of com.netflix.loadbalancer.Server

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.