📄 i_loadbalancer.java
字号:
/*------------------------------------------------------------------------------Name: I_LoadBalancer.javaProject: xmlBlaster.orgCopyright: xmlBlaster.org, see xmlBlaster-LICENSE fileComment: Interface top the load balancing implementationAuthor: xmlBlaster@marcelruff.info------------------------------------------------------------------------------*/package org.xmlBlaster.engine.cluster;import org.xmlBlaster.util.XmlBlasterException;import org.xmlBlaster.engine.ServerScope;import org.xmlBlaster.engine.cluster.ClusterManager;import java.util.Set;/** * Interface to the load balancing implementation. * <p /> * See http://www.ddj.com/documents/s=921/ddj9804i/9804i.htm * @author xmlBlaster@marcelruff.info */public interface I_LoadBalancer { /** * This is called after instantiation of the plugin * @param glob The Global handle of this xmlBlaster server instance. * @param clusterManager My manager */ public void initialize(ServerScope glob, ClusterManager clusterManager); /** * Your plugin should determine which xmlBlaster node to choose. * <p /> * You can access the necessary informations like this: * <pre> * Iterator it = clusterNodeSet.iterator(); * while (it.hasNext()) { * NodeDomainInfo nodeDomainInfo = (NodeDomainInfo)it.Next(); * * ... // Your load balancing code * * // Return the clusterNode if nodeDomainInfo is OK to handle the message: * ClusterNode clusterNode = nodeDomainInfo.getClusterNode(); * return clusterNode; * } * </pre> * This corresponds to the following XML configuration: * <pre> * <!-- NodeDomainInfo.java contains the parsed: --> * <master type='DomainToMaster' stratum='0'> * <key domain='RUGBY'/> * <key type='XPATH'>//STOCK</key> * </master> * </pre> * @param nodeDomainInfoSet A set containing NodeDomainInfo objects, the possible xmlBlaster nodes. * Is never null, but may have a size of 0. * The set i guaranteed to be sorted after<br /> * <pre> * "available:stratum:nodeId" * * available := The connection state is: 0 connected, 1 polling * stratum := 0 master, 1 slave, 2 slaveOfSlave ... * nodeId := a unique counter (nodeDomainInfo.getCount()) * </pre> * The set contains only nodes marked as allowed (these are nodes we are connected * to or polling for), not available nodes are filtered away already. * @return The chosen nodeDomainInfo to handle the message or null to handle it locally * You can access the master ClusterNode with <code>nodeDomainInfo.getClusterNode()</code> and the xmlBlasterConnection * to the master node with <code>nodeDomainInfo.getClusterNode().getXmlBlasterAccess()</code> */ public NodeDomainInfo getClusterNode(Set nodeDomainInfoSet) throws XmlBlasterException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -