public class SimpleServiceLoadBalancer<S extends Service,T extends ServiceLoad> extends AbstractServiceLoadBalancer<S,T>
Base.LoggingWriter, Base.StackFrame| Modifier and Type | Field and Description |
|---|---|
protected Map<Member,T> |
m_mapLoad
A Map of ServiceLoad objects keyed by their associated Member.
|
protected SortedMap<T,List<Member>> |
m_mapMember
A SortedMap of List of Member objects keyed by their associated ServiceLoad.
|
m_service| Constructor and Description |
|---|
SimpleServiceLoadBalancer()
Default constructor.
|
SimpleServiceLoadBalancer(Comparator<T> comparator)
Create a new SimpleServiceLoadBalancer that will order ServiceLoad objects using the specified Comparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(T load1, T load2)
Compare to ServerLoad objects.
|
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, T load)
Update the load balancing strategy in response to a change in a Service utilization.
|
getLocalMember, getService, init, isLocalMemberazzert, 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, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, 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, 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, waitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprotected final Map<Member,T extends ServiceLoad> m_mapLoad
protected final SortedMap<T extends ServiceLoad,List<Member>> m_mapMember
public SimpleServiceLoadBalancer()
public SimpleServiceLoadBalancer(Comparator<T> comparator)
comparator - the Comparator used to order ServiceLoad objectspublic void update(Member member, T load)
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)
client - the Member object that represents the remote clientpublic int compare(T load1, T load2)
ServiceLoadBalancerload1 - the first ServiceLoadload2 - the second ServiceLoad