|
@@ -42,7 +42,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public long addMachine(MachineInfo machineInfo) { |
|
|
public long addMachine(MachineInfo machineInfo) { |
|
|
logger.info("SimpleMachineDiscovery addMachine"); |
|
|
|
|
|
|
|
|
// logger.info("SimpleMachineDiscovery addMachine"); |
|
|
AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); |
|
|
AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); |
|
|
AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); |
|
|
AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); |
|
|
appInfo.addMachine(machineInfo); |
|
|
appInfo.addMachine(machineInfo); |
|
@@ -51,7 +51,7 @@ public class SimpleMachineDiscovery implements MachineDiscovery { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean removeMachine(String app, String ip, int port) { |
|
|
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"); |
|
|
AssertUtil.assertNotBlank(app, "app name cannot be blank"); |
|
|
AppInfo appInfo = apps.get(app); |
|
|
AppInfo appInfo = apps.get(app); |
|
|
if (appInfo != null) { |
|
|
if (appInfo != null) { |
|
@@ -64,20 +64,20 @@ public class SimpleMachineDiscovery implements MachineDiscovery { |
|
|
public List<String> getAppNames() { |
|
|
public List<String> getAppNames() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("apps.keySet is " + apps.keySet()); |
|
|
|
|
|
|
|
|
// logger.info("apps.keySet is " + apps.keySet()); |
|
|
return new ArrayList<>(apps.keySet()); |
|
|
return new ArrayList<>(apps.keySet()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public AppInfo getDetailApp(String app) { |
|
|
public AppInfo getDetailApp(String app) { |
|
|
logger.info("app is " + app); |
|
|
|
|
|
|
|
|
// logger.info("app is " + app); |
|
|
AssertUtil.assertNotBlank(app, "app name cannot be blank"); |
|
|
AssertUtil.assertNotBlank(app, "app name cannot be blank"); |
|
|
return apps.get(app); |
|
|
return apps.get(app); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Set<AppInfo> getBriefApps() { |
|
|
public Set<AppInfo> getBriefApps() { |
|
|
logger.info("apps is " + apps.toString()); |
|
|
|
|
|
|
|
|
// logger.info("apps is " + apps.toString()); |
|
|
return new HashSet<>(apps.values()); |
|
|
return new HashSet<>(apps.values()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|