From 34b46c74f8ee2204f86e0c09b51d4724598fc27d Mon Sep 17 00:00:00 2001 From: wangjx <1609724385@qq.com> Date: Sat, 26 Jun 2021 15:33:28 +0800 Subject: [PATCH] =?UTF-8?q?nacos=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/controller/AppController.java | 20 +++++++++---------- .../controller/v2/FlowControllerV2.java | 8 ++++---- .../discovery/SimpleMachineDiscovery.java | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java index 9b21c0c1..c614a7c7 100755 --- a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java +++ b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java @@ -62,16 +62,16 @@ public class AppController { public Result> queryAppInfos(HttpServletRequest request) { List list = new ArrayList<>(appManagement.getBriefApps()); - if (list.size() == 0) { - MachineInfo machineInfo = new MachineInfo(); - machineInfo.setApp("sentinel-dashboard"); - machineInfo.setAppType(0); - machineInfo.setHostname("id.ssjlai.com"); - machineInfo.setPort(7777); - machineInfo.setIp("172.19.42.44"); - appManagement.addMachine(machineInfo); - list = new ArrayList<>(appManagement.getBriefApps()); - } +// if (list.size() == 0) { +// MachineInfo machineInfo = new MachineInfo(); +// machineInfo.setApp("sentinel-dashboard"); +// machineInfo.setAppType(0); +// machineInfo.setHostname("id.ssjlai.com"); +// machineInfo.setPort(7777); +// machineInfo.setIp("172.19.42.44"); +// appManagement.addMachine(machineInfo); +// list = new ArrayList<>(appManagement.getBriefApps()); +// } Collections.sort(list, Comparator.comparing(AppInfo::getApp)); return Result.ofSuccess(list); } diff --git a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java index 9c1f1507..0ee89442 100755 --- a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java +++ b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java @@ -72,10 +72,10 @@ public class FlowControllerV2 { @GetMapping("/rules") @AuthAction(PrivilegeType.READ_RULE) public Result> apiQueryMachineRules(@RequestParam String app) { - System.out.println("FlowControllerV2 apiQueryMachineRules app is " + app); - if (StringUtils.isBlank(app)) { - app="sentinel-dashboard"; - } +// System.out.println("FlowControllerV2 apiQueryMachineRules app is " + app); +// if (StringUtils.isBlank(app)) { +// app="sentinel-dashboard"; +// } if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } diff --git a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java index e14f92b1..64f75397 100755 --- a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java +++ b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java @@ -42,7 +42,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { @Override public long addMachine(MachineInfo machineInfo) { - logger.info("SimpleMachineDiscovery addMachine"); +// logger.info("SimpleMachineDiscovery addMachine"); AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); appInfo.addMachine(machineInfo); @@ -51,7 +51,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { @Override public boolean removeMachine(String app, String ip, int port) { - logger.info("app is " + app); +// logger.info("app is " + app); AssertUtil.assertNotBlank(app, "app name cannot be blank"); AppInfo appInfo = apps.get(app); if (appInfo != null) { @@ -64,20 +64,20 @@ public class SimpleMachineDiscovery implements MachineDiscovery { public List getAppNames() { - logger.info("apps.keySet is " + apps.keySet()); +// logger.info("apps.keySet is " + apps.keySet()); return new ArrayList<>(apps.keySet()); } @Override public AppInfo getDetailApp(String app) { - logger.info("app is " + app); +// logger.info("app is " + app); AssertUtil.assertNotBlank(app, "app name cannot be blank"); return apps.get(app); } @Override public Set getBriefApps() { - logger.info("apps is " + apps.toString()); +// logger.info("apps is " + apps.toString()); return new HashSet<>(apps.values()); }