if (loadmetric.hasDefined(CommonAttributes.SIMPLE_LOAD_PROVIDER)) {
// TODO it seems we don't support that stuff.
// LoadBalanceFactorProvider implementation, org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProvider.
final ModelNode node = loadmetric.get(CommonAttributes.SIMPLE_LOAD_PROVIDER);
SimpleLoadBalanceFactorProvider myload = new SimpleLoadBalanceFactorProvider();
myload.setLoadBalanceFactor(node.get(CommonAttributes.FACTOR).asInt(1));
load = myload;
}
Set<LoadMetric<LoadContext>> metrics = new HashSet<LoadMetric<LoadContext>>();
if (loadmetric.hasDefined(CommonAttributes.DYNAMIC_LOAD_PROVIDER)) {
final ModelNode node = loadmetric.get(CommonAttributes.DYNAMIC_LOAD_PROVIDER);
int decayFactor = node.get(CommonAttributes.DECAY).asInt(512);
int history = node.get(CommonAttributes.HISTORY).asInt(512);
// We should have bunch of load-metric and/or custom-load-metric here.
// TODO read the child nodes or what ....String nodes = node.
if (node.hasDefined(CommonAttributes.LOAD_METRIC)) {
final ModelNode nodemetric = node.get(CommonAttributes.LOAD_METRIC);
final List<ModelNode> array = nodemetric.asList();
addLoadMetrics(metrics, array);
}
if (node.hasDefined(CommonAttributes.CUSTOM_LOAD_METRIC)) {
final ModelNode nodemetric = node.get(CommonAttributes.CUSTOM_LOAD_METRIC);
final List<ModelNode> array = nodemetric.asList();
addCustomLoadMetrics(metrics, array);
}
if (!metrics.isEmpty()) {
DynamicLoadBalanceFactorProvider loader = new DynamicLoadBalanceFactorProvider(metrics);
loader.setDecayFactor(decayFactor);
loader.setHistory(history);
load = loader;
}
}
if (load == null) {
// Use a default one...
log.info("Mod_cluster uses default load balancer provider");
SimpleLoadBalanceFactorProvider myload = new SimpleLoadBalanceFactorProvider();
myload.setLoadBalanceFactor(1);
load = myload;
}
service = new org.jboss.modcluster.ModClusterService(config, load);
adapter = new CatalinaEventHandlerAdapter(service, webServer.getValue().getServer(), webServer.getValue().getService());
try {