Interface ServiceLoadBalancer<S extends Service,T extends ServiceLoad>

All Superinterfaces:
Comparator<T>
All Known Subinterfaces:
ProxyServiceLoadBalancer
All Known Implementing Classes:
AbstractServiceLoadBalancer, DefaultProxyServiceLoadBalancer, SimpleServiceLoadBalancer

public interface ServiceLoadBalancer<S extends Service,T extends ServiceLoad> extends Comparator<T>
A ServiceLoadBalancer is a pluggable strategy for controlling the client load across individual members of a clustered Service.
Since:
Coherence 3.7
Author:
jh 2010.12.07
  • Method Details

    • init

      void init(S service)
      Called by the Service exactly once on this object as part of its initialization.
      Parameters:
      service - the containing Service
    • update

      void update(Member member, T load)
      Update the load balancing strategy in response to a change in a Service utilization.
      Parameters:
      member - the Member for which the utilization changed
      load - the updated ServiceLoad; if null, the utilization for the specified Member is unknown (e.g. when the Service on the specified Member leaves the cluster)
    • getMemberList

      List<Member> getMemberList(Member client)
      Called by the Service when a new client connects to obtain an ordered list of Members to which the new client should be redirected. If the returned list is null, empty, or contains a single Member that is the "local" Member, the client will remain connected to the calling Service.
      Parameters:
      client - the Member object that represents the remote client
      Returns:
      the ordered list of Member objects to which the client should be redirected
    • compare

      default int compare(T load1, T load2)
      Compare to ServerLoad objects.
      Specified by:
      compare in interface Comparator<S extends Service>
      Parameters:
      load1 - the first ServiceLoad
      load2 - the second ServiceLoad
      Returns:
      a negative integer, zero, or a positive integer indicating if load1 is less then, equal, or greater then load2