Package com.yugabyte.ysql
Interface LoadBalancer
- All Known Implementing Classes:
ClusterAwareLoadBalancer,TopologyAwareLoadBalancer
public interface LoadBalancer
An interface for any load balancing policy to implement. The LoadBalanceService invokes the
implemented methods while processing a new connection request.
-
Method Summary
Modifier and TypeMethodDescriptiongetLeastLoadedServer(boolean newRequest, List<String> failedHosts, ArrayList<String> timedOutHosts) intbooleanisHostEligible(Map.Entry<String, LoadBalanceService.NodeInfo> e, Byte requestFlags)
-
Method Details
-
isHostEligible
- Parameters:
e- TheLoadBalanceService.NodeInfoobject for the hostrequestFlags- The attributes for the load balancer to make use of- Returns:
- true, if a host is eligible to be considered for a connection request
-
getLeastLoadedServer
String getLeastLoadedServer(boolean newRequest, List<String> failedHosts, ArrayList<String> timedOutHosts) - Parameters:
newRequest- whether this invocation is first for a new connection requestfailedHosts- list of host names which have been known to be downtimedOutHosts- list of host names where connections were attempted but timed out- Returns:
- the name of a host with the least number of connections, as per the driver's stats
-
getRefreshListSeconds
int getRefreshListSeconds()- Returns:
- the value of the property "yb-servers-refresh-interval" specified either in the url or as a property
-