xmlBlaster 2.2.0 API

Interface I_LoadBalancer

All Known Implementing Classes:

public interface I_LoadBalancer

Interface to the load balancing implementation.

See http://www.ddj.com/documents/s=921/ddj9804i/9804i.htm


Method Summary
 NodeMasterInfo getClusterNode(java.util.Set nodeMasterInfoSet, java.lang.String keyOidForLogging)
          Your plugin should determine which xmlBlaster node to choose.
 void initialize(ServerScope glob, ClusterManager clusterManager)
          This is called after instantiation of the plugin

Method Detail


void initialize(ServerScope glob,
                ClusterManager clusterManager)
This is called after instantiation of the plugin

glob - The Global handle of this xmlBlaster server instance.
clusterManager - My manager


NodeMasterInfo getClusterNode(java.util.Set nodeMasterInfoSet,
                              java.lang.String keyOidForLogging)
                              throws XmlBlasterException
Your plugin should determine which xmlBlaster node to choose.

You can access the necessary informations like this:

  Iterator it = clusterNodeSet.iterator();
  while (it.hasNext()) {
     NodeMasterInfo nodeMasterInfo = (NodeMasterInfo)it.Next();

     ... // Your load balancing code

     // Return the clusterNode if nodeMasterInfo is OK to handle the message:
     ClusterNode clusterNode = nodeMasterInfo.getClusterNode();
     return clusterNode;
This corresponds to the following XML configuration:
  <!-- NodeMasterInfo.java contains the parsed: -->
  <master type='DomainToMaster' stratum='0'>
     <key domain='RUGBY'/>
     <key type='XPATH'>//STOCK</key>

nodeMasterInfoSet - A set containing NodeMasterInfo objects, the possible xmlBlaster nodes. Is never null, but may have a size of 0. The set i guaranteed to be sorted after

   available := The connection state is: 0 connected, 1 polling
   stratum   := 0 master, 1 slave, 2 slaveOfSlave ...
   nodeId    := a unique counter (nodeMasterInfo.getCount())
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.
keyOidForLogging - A nice string for logging the context
The chosen nodeMasterInfo to handle the message or null to handle it locally You can access the master ClusterNode with nodeMasterInfo.getClusterNode() and the xmlBlasterConnection to the master node with nodeMasterInfo.getClusterNode().getXmlBlasterAccess()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.