Interface LoadBalancedAddress<C extends LoadBalancedConnection>

Type Parameters:
C - type of LoadBalancedConnection.
All Superinterfaces:
AsyncCloseable, ListenableAsyncCloseable, ScoreSupplier

public interface LoadBalancedAddress<C extends LoadBalancedConnection> extends ListenableAsyncCloseable, ScoreSupplier
An address managed by a LoadBalancer.

Note: ScoreSupplier contract provides this address' score, where 0.0 is the lowest score and 1.0 is the highest. LoadBalancers prefer addresses with a higher score. Note: Weight provides a way to influence the selection of the connection with external factors. With a range of 0.1 to 1.0 influencing the connection score for selectivity.

  • Method Details

    • newConnection

      @Deprecated default Single<C> newConnection()
      Deprecated.
      Implement and use newConnection(ContextMap).
      Creates and asynchronously returns a connection for this address.
      Returns:
      Single that emits the created LoadBalancedConnection.
    • newConnection

      default Single<C> newConnection(@Nullable ContextMap context)
      Creates and asynchronously returns a connection for this address.
      Parameters:
      context - A context of the caller (e.g. request context) or null if no context provided.
      Returns:
      Single that emits the created LoadBalancedConnection.
    • weight

      default float weight(float weight)
      Enables addresses scoring to be influenced by a weight factor. Sets the weight of a resource and returns the previous one.
      Parameters:
      weight - The new weight.
      Returns:
      the previous associated weight.