Source:
protected void updateDiscoveredSessionConfig(Cluster cluster, GlusterGeoRepSession session) { List<GlusterGeoRepSessionConfiguration> sessionConfigList = getSessionConfigFromCLI(cluster, session); if (sessionConfigList == null) { log.info("No configuration information returned from VDS for session '{}'", session.getSessionKey()); return; } List<GlusterGeoRepSessionConfiguration> existingSessionConfigs = getGeoRepDao().getGeoRepSessionConfig(session.getId()); Map<String, GlusterGeoRepSessionConfiguration> existingKeyConfigMap = prepareMapOfGeoRepSessionConfigs(existingSessionConfigs); for (GlusterGeoRepSessionConfiguration sessionConfig : sessionConfigList) { sessionConfig.setId(session.getId()); if (!existingSessionConfigs.contains(sessionConfig)) { if (existingKeyConfigMap.containsKey(sessionConfig.getKey())) { getGeoRepDao().updateConfig(sessionConfig); String oldValue = existingKeyConfigMap.get(sessionConfig.getKey()).getValue(); logGeoRepMessage(AuditLogType.GEOREP_OPTION_CHANGED_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), oldValue)); } else { getGeoRepDao().saveConfig(sessionConfig); logGeoRepMessage(AuditLogType.GEOREP_OPTION_SET_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), null)); } } } Map<String, GlusterGeoRepSessionConfiguration> sessionKeyConfigMap = prepareMapOfGeoRepSessionConfigs(sessionConfigList); existingKeyConfigMap.keySet().removeAll(sessionKeyConfigMap.keySet()); for (Map.Entry<String, GlusterGeoRepSessionConfiguration> stringGlusterGeoRepSessionConfigurationEntry : existingKeyConfigMap.entrySet()) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setId(session.getId()); config.setKey(stringGlusterGeoRepSessionConfigurationEntry.getKey()); getGeoRepDao().updateConfig(config); } }

Target:
protected void updateDiscoveredSessionConfig(Cluster cluster, GlusterGeoRepSession session) { List<GlusterGeoRepSessionConfiguration> sessionConfigList = getSessionConfigFromCLI(cluster, session); if (sessionConfigList == null) { log.info("No configuration information returned from VDS for session '{}'", session.getSessionKey()); return; } List<GlusterGeoRepSessionConfiguration> existingSessionConfigs = getGeoRepDao().getGeoRepSessionConfig(session.getId()); Map<String, GlusterGeoRepSessionConfiguration> existingKeyConfigMap = prepareMapOfGeoRepSessionConfigs(existingSessionConfigs); for (GlusterGeoRepSessionConfiguration sessionConfig : sessionConfigList) { sessionConfig.setId(session.getId()); if (!existingSessionConfigs.contains(sessionConfig)) { if (existingKeyConfigMap.containsKey(sessionConfig.getKey())) { getGeoRepDao().updateConfig(sessionConfig); String oldValue = existingKeyConfigMap.get(sessionConfig.getKey()).getValue(); logGeoRepMessage(AuditLogType.GEOREP_OPTION_CHANGED_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), oldValue)); } else { getGeoRepDao().saveConfig(sessionConfig); logGeoRepMessage(AuditLogType.GEOREP_OPTION_SET_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), null)); } } } Map<String, GlusterGeoRepSessionConfiguration> sessionKeyConfigMap = prepareMapOfGeoRepSessionConfigs(sessionConfigList); existingKeyConfigMap.keySet().removeAll(sessionKeyConfigMap.keySet()); existingKeyConfigMap.keySet().forEach(key -> { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setId(session.getId()); config.setKey(key); getGeoRepDao().updateConfig(config); }); }