{
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
getUser(), getPassword());
DomainRoot domainRoot = ProxyFactory.getInstance(mbsc).getDomainRoot();
LBConfigHelper lbconfigHelper = new LBConfigHelper(domainRoot);
lbconfigHelper.createLoadBalancer(lbName, target, getLBParams(),
getLBProperties());
//Now configure the weights for the target cluster
final boolean isCluster =
domainRoot.getDomainConfig().getClusterConfigMap().keySet().contains(target);
if ( ! isCluster )
{
//display warning and continue
_strMgr.getString("WeightCannotApplyToNonCluster",
new Object[] {target});
}
else if (getOption(LBConfigHelper.LB_WEIGHT) != null)
lbconfigHelper.configureLBWeight(target, instanceWeights);
//Test the connection if autoapplyenabled is true and
// display warning if pinging is unsuccesful
if (autoApplyEnabled)
{
if (!domainRoot.getLoadBalancerMap().get(lbName).testConnection())