Class BaseLoadBalancer
- java.lang.Object
-
- com.smartfoxserver.cluster.balancer.BaseLoadBalancer
-
- All Implemented Interfaces:
ILoadBalancer
public abstract class BaseLoadBalancer extends java.lang.Object implements ILoadBalancer
This class serves as the parent for all implementation of Load Balancing logic for SFS2X Cluster.A new implementation of the ILoadBalancer will typically extend the BaseLoadBalancer class which offers a few concrete methods to access the current nodes in the cluster and read the configuration properties for the Load Balancer itself.
-
-
Constructor Summary
Constructors Constructor Description BaseLoadBalancer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<com.smartfoxserver.cluster.data.SFSGameNode>getGameNodes()Provides the list of active(1) and healthy(2) Game Nodes currently connected to the cluster.protected java.lang.StringgetProperty(java.lang.String key)Get the value of specific load balancer setting.voidinit()Used for custom initialization if necessary-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.smartfoxserver.cluster.balancer.ILoadBalancer
process
-
-
-
-
Method Detail
-
init
public void init()
Description copied from interface:ILoadBalancerUsed for custom initialization if necessary- Specified by:
initin interfaceILoadBalancer
-
getGameNodes
protected java.util.Collection<com.smartfoxserver.cluster.data.SFSGameNode> getGameNodes()
Provides the list of active(1) and healthy(2) Game Nodes currently connected to the cluster.- active: nodes joined in the cluster
- healthy: nodes that have replied to health checks in less than the configured threshold
- Returns:
- the list of Game Nodes currently connected to the cluster
-
getProperty
protected java.lang.String getProperty(java.lang.String key)
Get the value of specific load balancer setting.These values are configured via the AdminTool > Cluster Settings and provide runtime custom configuration for the LB
- Parameters:
key- the key name- Returns:
- the value associated with the provided key, or null if no value is associated to that key
-
-