Ribbon load-balanced coupling method, which converges to Iping,irule, ServerList, Serverlistupdater, Serverlistfilter.
Public interface iloadbalancer { /** * initial list of servers. * this api also serves to add additional ones at a later time * the same logical server (Host:port) could essentially be added multiple times * (helpful in cases where you want to give more "Weightage" perhaps  ...) * * @param newservers new servers to add */ public void addservers (List<Server > newservers); /** * choose a server from load balancer. * * @param key An object that the load balancer may use to determine which server to return. null if * the load balancer does not use this parameter. * @return server chosen */ public server chooseserver (Object key); /** * to be called by the clients of the load balancer to notify that a server is down * else, the lb will think its still alive until the next Ping cycle - potentially * ( Assuming that the lb impl does a ping) * * @ param server server to mark as down */ Public void markserverdown (Server server); /** * @deprecated 2016-01-20 This method is deprecated in favor of the * cleaner {@link #getReachableServers} ( equivalent to availableonly=true) * and {@link #getAllServers} API (Equivalent to availableonly=false) . * * get the current list of servers. * * @param availableOnly if true, only live and available servers should be returned */ @Deprecated public List< Server> getserverlist (boolean availableonly); /** * @return Only the servers that are up and reachable. */ public list<server> getreachableservers (); /** * @return All known servers, both reachable and unreachable. */ public list< Server> getallservers ();}
public abstract class abstractloadbalancer implements iloadbalancer { public enum ServerGroup{ ALL, STATUS_UP, STATUS_NOT_UP } /** * delegate to {@link #chooseServer (Object)} with parameter null. */ public server chooseserver () { return chooseserver (NULL); } /** * List of servers that this Loadbalancer knows about * * @param serverGroup servers grouped by status, e.g., {@link ServerGroup#STATUS_UP} */ public abstract list<server> getserverlist ( Servergroup servergroup); /** * Obtain LoadBalancer related Statistics */ public abstract loadbalancerstats getloadbalancerstats (); }
The interface used by Iloadbalancer is basically implemented.
On the Baseloadbalancer, add extra features. This is mainly to implement dynamic service list features.
On top of the Dynamicserverlistloadbalancer, additional features are added. To configure multiple loadbalancer in the form of a zone.
The Iloadbalancer of the Ribbon