if (eventHandler != null) {
String clazz =
eventHandler.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE,
"class")).trim();
try {
LoadBalanceMembershipHandler lbMembershipHandler =
(LoadBalanceMembershipHandler) Class.forName(clazz).newInstance();
Properties lbProperties = new Properties();
for (Iterator props = eventHandler.getChildrenWithName(new QName(
SynapseConstants.SYNAPSE_NAMESPACE, "property")); props.hasNext();) {
OMElement prop = (OMElement) props.next();
String propName =
prop.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE,
"name")).trim();
String propValue =
prop.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE,
"value")).trim();
lbProperties.put(propName, propValue);
}
// Set load balance algorithm
LoadbalanceAlgorithm algorithm =
LoadbalanceAlgorithmFactory.
createLoadbalanceAlgorithm(loadbalanceElement, null);
lbMembershipHandler.init(lbProperties, algorithm);
loadbalanceEndpoint.setLoadBalanceMembershipHandler(lbMembershipHandler);
} catch (Exception e) {
String msg = "Could not instantiate " +
"LoadBalanceMembershipHandler implementation " + clazz;
log.error(msg, e);