com.alibaba.edas.configcenter.config.ConfigService Maven / Gradle / Ivy
package com.alibaba.edas.configcenter.config;
import static com.taobao.diamond.client.impl.DiamondEnvRepo.defaultEnv;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* Provide dynamic configuration management services
*
* @author ConfigCenter
*
*/
public class ConfigService {
/**
* @param dataId
* @param group
* @param listener
*/
public static void addListener(String dataId, String group, ConfigChangeListenerAdapter listener) {
defaultEnv.addListeners(dataId, group, Arrays.asList(listener));
}
/**
* @param dataId
* @param group
* @param listeners
*/
public static void addListeners(String dataId, String group, List listeners) {
defaultEnv.addListeners(dataId, group, listeners);
}
/**
* @param dataId
* @param group
* @param listener
*/
public static void removeListener(String dataId, String group, ConfigChangeListenerAdapter listener) {
defaultEnv.removeListener(dataId, group, listener);
}
public static String getConfig(String dataId, String group, long timeoutMs) throws IOException {
return defaultEnv.getConfig(dataId, group, timeoutMs);
}
}