public class DefaultProxyServiceLoadBalancer extends SimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad> implements ProxyServiceLoadBalancer
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.
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected ProxyServiceLoad |
m_loadLocal
The ServiceLoad associated with the "local" Member.
|
m_mapLoad, m_mapMember
m_service
Constructor and Description |
---|
DefaultProxyServiceLoadBalancer()
Default constructor.
|
DefaultProxyServiceLoadBalancer(Comparator comparator)
Create a new DefaultProxyServiceLoadBalancer that will order
ProxyServiceLoad objects using the specified Comparator.
|
Modifier and Type | Method and 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.
|
compare
getLocalMember, getService, init, isLocalMember
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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compare, init
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
protected ProxyServiceLoad m_loadLocal
public DefaultProxyServiceLoadBalancer()
public DefaultProxyServiceLoadBalancer(Comparator comparator)
comparator
- the Comparator used to order ProxyServiceLoad
objectspublic void update(Member member, ProxyServiceLoad load)
SimpleServiceLoadBalancer
update
in interface ServiceLoadBalancer<ProxyService,ProxyServiceLoad>
update
in class SimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad>
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)public List<Member> getMemberList(Member client)
SimpleServiceLoadBalancer
getMemberList
in interface ServiceLoadBalancer<ProxyService,ProxyServiceLoad>
getMemberList
in class SimpleServiceLoadBalancer<ProxyService,ProxyServiceLoad>
client
- the Member object that represents the remote client