Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.net.proxy
Class DefaultProxyServiceLoadBalancer

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.proxy.AbstractProxyServiceLoadBalancer
          extended by com.tangosol.net.proxy.DefaultProxyServiceLoadBalancer

All Implemented Interfaces:
ProxyServiceLoadBalancer

public class DefaultProxyServiceLoadBalancer
extends AbstractProxyServiceLoadBalancer

Default ProxyServiceLoadBalancer implementation.

This implementation will redirect a new client connection to another ProxyService Member if a less utilized Member is identified. A Member is considered less utilized than another iff it's associated ProxyServiceLoad object is less than the ProxyServiceLoad of the other Member according to the Comparator specified during construction. By default, the natural ordering of the ProxyServiceLoad objects is used.

Author:
jh 2010.12.10

Field Summary
protected  ProxyServiceLoad m_loadLocal
          The ProxyServiceLoad associated with the "local" Member.
protected  java.util.Map m_mapLoad
          A Map of ProxyServiceLoad objects keyed by their associated Member.
protected  java.util.SortedMap m_mapMember
          A SortedMap of Member objects keyed by their associated ProxyServiceLoad.

 

Fields inherited from class com.tangosol.net.proxy.AbstractProxyServiceLoadBalancer
m_service

 

Constructor Summary
DefaultProxyServiceLoadBalancer()
          Default constructor.
DefaultProxyServiceLoadBalancer(java.util.Comparator comparator)
          Create a new DefaultProxyServiceLoadBalancer that will order ProxyServiceLoad objects using the specified Comparator.

 

Method Summary
 java.util.List getMemberList(Member client)
          Called by the ProxyService when a new client connects to obtain an ordered list of Members to which the new client should be redirected.
 void update(Member member, ProxyServiceLoad load)
          Update the load balancing strategy in response to a change in a ProxyService utilization.

 

Methods inherited from class com.tangosol.net.proxy.AbstractProxyServiceLoadBalancer
getLocalMember, getService, init, isLocalMember

 

Field Detail

m_loadLocal

protected ProxyServiceLoad m_loadLocal
The ProxyServiceLoad associated with the "local" Member.

m_mapLoad

protected final java.util.Map m_mapLoad
A Map of ProxyServiceLoad objects keyed by their associated Member.

m_mapMember

protected final java.util.SortedMap m_mapMember
A SortedMap of Member objects keyed by their associated ProxyServiceLoad.

Constructor Detail

DefaultProxyServiceLoadBalancer

public DefaultProxyServiceLoadBalancer()
Default constructor.

DefaultProxyServiceLoadBalancer

public DefaultProxyServiceLoadBalancer(java.util.Comparator comparator)
Create a new DefaultProxyServiceLoadBalancer that will order ProxyServiceLoad objects using the specified Comparator. If null, the natural ordering of the ProxyServiceLoad objects will be used.
Parameters:
comparator - the Comparator used to order ProxyServiceLoad objects

Method Detail

update

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

getMemberList

public java.util.List getMemberList(Member client)
Called by the ProxyService 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 ProxyService.
Parameters:
client - the Member object that represents the remote client
Returns:
the ordered list of Member objects to which the client should be redirected

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.