in src/frontend/src/main/java/com/alibabacloud/hipstershop/web/RouteDemoController.java [35:89]
public String routerResult(Model model) {
synchronized (SPRING_CLOUD_LOCK) {
SPRING_CLOUD_RESULT_LIST.clear();
SPRING_CLOUD_RESULT_MAP.clear();
for (String str : SPRING_CLOUD_RESULT_QUEUE) {
if (null == SPRING_CLOUD_RESULT_MAP.get(str)) {
SPRING_CLOUD_RESULT_MAP.put(str, 1);
} else {
int count = SPRING_CLOUD_RESULT_MAP.get(str);
count++;
SPRING_CLOUD_RESULT_MAP.put(str, count);
}
}
for (Map.Entry<String, Integer> entry : SPRING_CLOUD_RESULT_MAP.entrySet()) {
SPRING_CLOUD_RESULT_LIST.add(new ResultNode(entry.getKey(), entry.getValue()));
}
model.addAttribute("spring_cloud_router_result", SPRING_CLOUD_RESULT_LIST);
}
synchronized (DUBBO_LOCK) {
DUBBO_RESULT_LIST.clear();
DUBBO_RESULT_MAP.clear();
for (String str : DUBBO_RESULT_QUEUE) {
if (null == DUBBO_RESULT_MAP.get(str)) {
DUBBO_RESULT_MAP.put(str, 1);
} else {
int count = DUBBO_RESULT_MAP.get(str);
count++;
DUBBO_RESULT_MAP.put(str, count);
}
}
for (Map.Entry<String, Integer> entry : DUBBO_RESULT_MAP.entrySet()) {
DUBBO_RESULT_LIST.add(new ResultNode(entry.getKey(), entry.getValue()));
}
model.addAttribute("dubbo_router_result", DUBBO_RESULT_LIST);
}
model.addAttribute("spring_cloud_name", spring_cloud_name);
model.addAttribute("spring_cloud_age", spring_cloud_age);
model.addAttribute("dubbo_name", dubbo_name);
model.addAttribute("dubbo_age", dubbo_age);
return "router.html";
}