Package com.tangosol.net
Class SimpleServiceLoadBalancer<S extends Service,T extends ServiceLoad> 
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.AbstractServiceLoadBalancer<S,T>
 
com.tangosol.net.SimpleServiceLoadBalancer<S,T> 
- All Implemented Interfaces:
- ServiceLoadBalancer<S,,- T> - Comparator<T>
- Direct Known Subclasses:
- DefaultProxyServiceLoadBalancer
public class SimpleServiceLoadBalancer<S extends Service,T extends ServiceLoad> 
extends AbstractServiceLoadBalancer<S,T> 
A simple ServiceLoadBalancer implementation.
- Author:
- jh 2010.12.07
- 
Nested Class SummaryNested classes/interfaces inherited from class com.tangosol.util.BaseBase.LoggingWriter
- 
Field SummaryFieldsModifier and TypeFieldDescriptionA Map of ServiceLoad objects keyed by their associated Member.A SortedMap of List of Member objects keyed by their associated ServiceLoad.Fields inherited from class com.tangosol.net.AbstractServiceLoadBalancerm_service
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.SimpleServiceLoadBalancer(Comparator<T> comparator) Create a new SimpleServiceLoadBalancer that will order ServiceLoad objects using the specified Comparator.
- 
Method SummaryModifier and TypeMethodDescriptionintCompare 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.voidUpdate the load balancing strategy in response to a change in a Service utilization.Methods inherited from class com.tangosol.net.AbstractServiceLoadBalancergetLocalMember, getService, init, isLocalMemberMethods inherited from class com.tangosol.util.Baseazzert, 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, waitMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorequals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Field Details- 
m_mapLoadA Map of ServiceLoad objects keyed by their associated Member.
- 
m_mapMemberA SortedMap of List of Member objects keyed by their associated ServiceLoad.
 
- 
- 
Constructor Details- 
SimpleServiceLoadBalancerpublic SimpleServiceLoadBalancer()Default constructor.
- 
SimpleServiceLoadBalancerCreate a new SimpleServiceLoadBalancer that will order ServiceLoad objects using the specified Comparator. If null, the natural ordering of the ServiceLoad objects will be used.- Parameters:
- comparator- the Comparator used to order ServiceLoad objects
 
 
- 
- 
Method Details- 
updateUpdate the load balancing strategy in response to a change in a Service utilization.- Parameters:
- member- the Member for which the utilization changed
- load- 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)
 
- 
getMemberListCalled 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
 
- 
compareDescription copied from interface:ServiceLoadBalancerCompare to ServerLoad objects.- Parameters:
- load1- the first ServiceLoad
- load2- the second ServiceLoad
- Returns:
- a negative integer, zero, or a positive integer indicating if load1 is less then, equal, or greater then load2
 
 
-