Package com.tangosol.net.proxy
Class DefaultProxyServiceLoadBalancer
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.net.AbstractServiceLoadBalancer<S,T>
-
- com.tangosol.net.SimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad>
-
- com.tangosol.net.proxy.DefaultProxyServiceLoadBalancer
-
- All Implemented Interfaces:
ProxyServiceLoadBalancer
,ServiceLoadBalancer<ProxyService,ProxyServiceLoad>
,Comparator<ProxyServiceLoad>
public class DefaultProxyServiceLoadBalancer extends SimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad> implements ProxyServiceLoadBalancer
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected ProxyServiceLoad
m_loadLocal
The ServiceLoad associated with the "local" Member.-
Fields inherited from class com.tangosol.net.SimpleServiceLoadBalancer
m_mapLoad, m_mapMember
-
Fields inherited from class com.tangosol.net.AbstractServiceLoadBalancer
m_service
-
-
Constructor Summary
Constructors Constructor Description DefaultProxyServiceLoadBalancer()
Default constructor.DefaultProxyServiceLoadBalancer(Comparator comparator)
Create a new DefaultProxyServiceLoadBalancer that will order ProxyServiceLoad objects using the specified Comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
update(Member member, ProxyServiceLoad load)
Update the load balancing strategy in response to a change in a Service utilization.-
Methods inherited from class com.tangosol.net.SimpleServiceLoadBalancer
compare
-
Methods inherited from class com.tangosol.net.AbstractServiceLoadBalancer
getLocalMember, getService, init, isLocalMember
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface com.tangosol.net.ServiceLoadBalancer
compare, init
-
-
-
-
Field Detail
-
m_loadLocal
protected ProxyServiceLoad m_loadLocal
The ServiceLoad associated with the "local" Member.
-
-
Constructor Detail
-
DefaultProxyServiceLoadBalancer
public DefaultProxyServiceLoadBalancer()
Default constructor.
-
DefaultProxyServiceLoadBalancer
public DefaultProxyServiceLoadBalancer(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)
Description copied from class:SimpleServiceLoadBalancer
Update the load balancing strategy in response to a change in a Service utilization.- Specified by:
update
in interfaceServiceLoadBalancer<ProxyService,ProxyServiceLoad>
- Overrides:
update
in classSimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad>
- 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
public List<Member> getMemberList(Member client)
Description copied from class:SimpleServiceLoadBalancer
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.- Specified by:
getMemberList
in interfaceServiceLoadBalancer<ProxyService,ProxyServiceLoad>
- Overrides:
getMemberList
in classSimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad>
- Parameters:
client
- the Member object that represents the remote client- Returns:
- the ordered list of Member objects to which the client should be redirected
-
-