Package com.tangosol.net
Interface ServiceLoadBalancer<S extends Service,T extends ServiceLoad>
- All Superinterfaces:
Comparator<T>
- All Known Subinterfaces:
ProxyServiceLoadBalancer
- All Known Implementing Classes:
AbstractServiceLoadBalancer
,DefaultProxyServiceLoadBalancer
,SimpleServiceLoadBalancer
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 Summary
Modifier and TypeMethodDescriptiondefault int
Compare to ServerLoad objects.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.void
Called by the Service exactly once on this object as part of its initialization.void
Update the load balancing strategy in response to a change in a Service utilization.Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
init
Called by the Service exactly once on this object as part of its initialization.- Parameters:
service
- the containing Service
-
update
Update the load balancing strategy in response to a change in a Service utilization.- Parameters:
member
- the Member for which the utilization changedload
- 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
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
Compare to ServerLoad objects.- Specified by:
compare
in interfaceComparator<S extends Service>
- Parameters:
load1
- the first ServiceLoadload2
- the second ServiceLoad- Returns:
- a negative integer, zero, or a positive integer indicating if load1 is less then, equal, or greater then load2
-