/** * Add MBean monitors on the given monitorTargets. * * @param monitorTargets a set of monitor targets * @param reportPath report path */ public void add(Set<AgentInfo> monitorTargets, File reportPath) { for (AgentInfo target : monitorTargets) { String targetKey = createTargetKey(target); if (!monitorClientsMap.containsKey(targetKey)) { MonitorClientSerivce bean = applicationContext.getBean(MonitorClientSerivce.class); bean.init( target.getIp(), target.getPort(), reportPath, cacheManager.getCache("monitor_data")); monitorClientsMap.put(targetKey, bean); } } }
private String createTargetKey(AgentInfo target) { return target.getIp(); }