getChildrenWithName((MEMBER)).hasNext()){
String msg =
"Invalid Synapse configuration. " +
"child elements";
log.error(msg);
throw new SynapseException(msg);
}
List<Endpoint> endpoints
= getEndpoints(loadbalanceElement, loadbalanceEndpoint, properties);
loadbalanceEndpoint.setChildren(endpoints);
algorithm =
LoadbalanceAlgorithmFactory.
createLoadbalanceAlgorithm(loadbalanceElement, endpoints);
algorithm.setLoadBalanceEndpoint(loadbalanceEndpoint);
} else if (loadbalanceElement.getFirstChildWithName(MEMBER) != null) {
if(loadbalanceElement.
getChildrenWithName((XMLConfigConstants.ENDPOINT_ELT)).hasNext()){
String msg =
"Invalid Synapse configuration. " +
"loadbalanceEndpoint element cannot have both member & endpoint " +
"child elements";
log.error(msg);
throw new SynapseException(msg);
}
List<Member> members = getMembers(loadbalanceElement);
loadbalanceEndpoint.setMembers(members);
algorithm =
LoadbalanceAlgorithmFactory.
createLoadbalanceAlgorithm2(loadbalanceElement, members);
loadbalanceEndpoint.startApplicationMembershipTimer();
}
if (loadbalanceEndpoint.getChildren() == null &&
loadbalanceEndpoint.getMembers() == null) {
String msg = "Invalid Synapse configuration.\n"
+ "A LoadbalanceEndpoint must have child elements, but the LoadbalanceEndpoint "
+ "'" + loadbalanceEndpoint.getName() + "' does not have any child elements.";
log.error(msg);
throw new SynapseException(msg);
}
// set load balance algorithm
loadbalanceEndpoint.setAlgorithm(algorithm);