use of com.alibaba.dubbo.registry.common.domain.LoadBalance in project dubbo by alibaba.
the class Loadbalances method show.
public void show(Long id, Map<String, Object> context) {
LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id));
context.put("loadbalance", loadbalance);
}
use of com.alibaba.dubbo.registry.common.domain.LoadBalance in project dubbo by alibaba.
the class OverrideUtils method overridesToLoadBalances.
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides) {
List<LoadBalance> loadBalances = new ArrayList<LoadBalance>();
if (overrides == null) {
return loadBalances;
}
for (Override o : overrides) {
if (StringUtils.isEmpty(o.getParams())) {
continue;
} else {
Map<String, String> params = StringUtils.parseQueryString(o.getParams());
for (Map.Entry<String, String> entry : params.entrySet()) {
if (entry.getKey().endsWith("loadbalance")) {
LoadBalance loadBalance = new LoadBalance();
String method = null;
if (entry.getKey().endsWith(".loadbalance")) {
method = entry.getKey().split(".loadbalance")[0];
} else {
method = "*";
}
loadBalance.setMethod(method);
loadBalance.setId(o.getId());
loadBalance.setService(o.getService());
loadBalance.setStrategy(entry.getValue());
loadBalances.add(loadBalance);
}
}
}
}
return loadBalances;
}
Aggregations