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);
}