Interface LoadBalancer


public interface LoadBalancer
LoadBalancer allows you to send operations to one of a number of endpoints (members). It is up to the implementation to use different load balancing policies.

If the client is not configured with RoutingMode.SINGLE_MEMBER, operations that are not key-based will be routed to the endpoint returned by the LoadBalancer. For SINGLE_MEMBER routing clients, the LoadBalancer is not used.

For configuration see ClientConfig.setLoadBalancer(LoadBalancer).

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    the method is unused
    void
    init(Cluster cluster, ClientConfig config)
    Initializes the LoadBalancer.
    Returns the next member to route to.
    default Member
    Deprecated, for removal: This API element is subject to removal in a future version.
    the method is unused
  • Method Details

    • init

      void init(Cluster cluster, ClientConfig config)
      Initializes the LoadBalancer.
      Parameters:
      cluster - the Cluster this LoadBalancer uses to select members from.
      config - the ClientConfig.
    • next

      Member next()
      Returns the next member to route to.
      Returns:
      Returns the next member or null if no member is available
    • nextDataMember

      @Deprecated(since="5.0", forRemoval=true) default Member nextDataMember()
      Deprecated, for removal: This API element is subject to removal in a future version.
      the method is unused
      Returns the next data member or null if no data member is available.
      Throws:
      UnsupportedOperationException - if the operation is not supported by this instance
      Since:
      4.2
    • canGetNextDataMember

      @Deprecated(since="5.0", forRemoval=true) default boolean canGetNextDataMember()
      Deprecated, for removal: This API element is subject to removal in a future version.
      the method is unused
      Returns whether this instance supports getting data members through a call to nextDataMember().
      Since:
      4.2
      See Also: