Class RoundRobinLoadBalancer<ResolvedAddress,​C extends LoadBalancedConnection>

  • Type Parameters:
    ResolvedAddress - The resolved address type.
    C - The type of connection.
    All Implemented Interfaces:
    LoadBalancer<C>, AsyncCloseable, ListenableAsyncCloseable

    public final class RoundRobinLoadBalancer<ResolvedAddress,​C extends LoadBalancedConnection>
    extends java.lang.Object
    implements LoadBalancer<C>
    A LoadBalancer that uses a round robin strategy for selecting addresses. It has the following behaviour:
    • Round robining is done at address level.
    • Connections are created lazily, without any concurrency control on their creation. This can lead to over-provisioning connections when dealing with a requests surge.
    • Existing connections are reused unless a selector passed to selectConnection(Predicate) suggests otherwise. This can lead to situations where connections will be used to their maximum capacity (for example in the context of pipelining) before new connections are created.
    • Closed connections are automatically pruned.