Package com.hazelcast.client.util
Class RoundRobinLB
java.lang.Object
com.hazelcast.client.util.AbstractLoadBalancer
com.hazelcast.client.util.RoundRobinLB
- All Implemented Interfaces:
LoadBalancer
,InitialMembershipListener
,MembershipListener
,EventListener
public class RoundRobinLB extends AbstractLoadBalancer
A
LoadBalancer
implementation that relies on using round robin
to a next member to send a request to.
Round robin is done based on best effort basis, the order of members for concurrent calls to
the next()
is not guaranteed.-
Constructor Summary
Constructors Constructor Description RoundRobinLB()
RoundRobinLB(int seed)
-
Method Summary
Modifier and Type Method Description boolean
canGetNextDataMember()
Returns whether this instance supports getting data members through a call toLoadBalancer.nextDataMember()
.Member
next()
Returns the next member to route to.Member
nextDataMember()
Returns the next data member to route to.Methods inherited from class com.hazelcast.client.util.AbstractLoadBalancer
getDataMembers, getMembers, init, init, memberAdded, memberRemoved
-
Constructor Details
-
RoundRobinLB
public RoundRobinLB() -
RoundRobinLB
public RoundRobinLB(int seed)
-
-
Method Details
-
next
Description copied from interface:LoadBalancer
Returns the next member to route to.- Returns:
- Returns the next member or null if no member is available
-
nextDataMember
Description copied from interface:LoadBalancer
Returns the next data member to route to.- Returns:
- Returns the next data member or null if no data member is available
-
canGetNextDataMember
public boolean canGetNextDataMember()Description copied from interface:LoadBalancer
Returns whether this instance supports getting data members through a call toLoadBalancer.nextDataMember()
.This method is used by components that require communication with data members only, such as the SQL engine.
- Returns:
true
if this instance supports getting data members through a call toLoadBalancer.nextDataMember()
- See Also:
LoadBalancer.nextDataMember()
-