Package org.factor45.malabarista.util

Examples of org.factor45.malabarista.util.HostAndPort


            System.err.println("At least one destination address must be provided.");
            printUsage();
        }

        RoundRobinBalancingStrategy strategy = new RoundRobinBalancingStrategy(options.getDestinationAddresses());
        final DefaultLoadBalancer loadBalancer =
                new DefaultLoadBalancer("defaultLoadBalancer", options.getBalancerAddress(), strategy);

        if (!loadBalancer.init()) {
            System.err.println("Failed to launch LoadBalancer with options: " + options);
            return;
        }

        Thread shutdownHook = new Thread() {

            @Override
            public void run() {
                loadBalancer.terminate();
            }
        };
        Runtime.getRuntime().addShutdownHook(shutdownHook);
    }
View Full Code Here


        if ((options.getDestinationAddresses() == null) || options.getDestinationAddresses().isEmpty()) {
            System.err.println("At least one destination address must be provided.");
            printUsage();
        }

        RoundRobinBalancingStrategy strategy = new RoundRobinBalancingStrategy(options.getDestinationAddresses());
        final DefaultLoadBalancer loadBalancer =
                new DefaultLoadBalancer("defaultLoadBalancer", options.getBalancerAddress(), strategy);

        if (!loadBalancer.init()) {
            System.err.println("Failed to launch LoadBalancer with options: " + options);
View Full Code Here

        this.allChannels = new DefaultChannelGroup(this.id + "-all-channels-" + Integer.toHexString(this.hashCode()));

        this.bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new TcpTunnelInboundHandler(id, allChannels, clientSocketChannelFactory,
                                                                     balancingStrategy, timeoutInMillis));
            }
        });

        // Start up the server.
View Full Code Here

        // public static methods --------------------------------------------------------------------------------------

        public static CommandLineOptions parseCommandLineOptions(String[] args) {
            CommandLineOptions options = new CommandLineOptions();
            HostAndPort address;

            for (String arg : args) {
                if (arg.length() < 3) {
                    System.err.println("Invalid argument ignored: " + arg);
                    continue;
View Full Code Here

    @Override
    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        this.channelGroup.add(e.getChannel());

        InetSocketAddress address = (InetSocketAddress) e.getChannel().getRemoteAddress();
        HostAndPort target = this.strategy.selectTarget(address.getHostName(), address.getPort());
        this.remoteHost = target.getHost();
        this.remotePort = target.getPort();

        // Suspend incoming traffic until connected to the remote host.
        final Channel inboundChannel = e.getChannel();
        inboundChannel.setReadable(false);
View Full Code Here

TOP

Related Classes of org.factor45.malabarista.util.HostAndPort

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.