本文整理汇总了Java中com.baidu.disconf.client.config.ConfigMgr类的典型用法代码示例。如果您正苦于以下问题:Java ConfigMgr类的具体用法?Java ConfigMgr怎么用?Java ConfigMgr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigMgr类属于com.baidu.disconf.client.config包,在下文中一共展示了ConfigMgr类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFetcherMgr
import com.baidu.disconf.client.config.ConfigMgr; //导入依赖的package包/类
/**
* 获取抓取器实例,记得释放资源, 它依赖Conf模块
*/
public static FetcherMgr getFetcherMgr() throws Exception {
if (!ConfigMgr.isInit()) {
throw new Exception("ConfigMgr should be init before FetcherFactory.getFetcherMgr");
}
// 获取一个默认的抓取器
RestfulMgr restfulMgr = RestfulFactory.getRestfulMgrNomal();
FetcherMgr fetcherMgr =
new FetcherMgrImpl(restfulMgr, DisClientConfig.getInstance().CONF_SERVER_URL_RETRY_TIMES,
DisClientConfig.getInstance().confServerUrlRetrySleepSeconds,
DisClientConfig.getInstance().enableLocalDownloadDirInClassPath,
DisClientConfig.getInstance().userDefineDownloadDir,
DisClientSysConfig.getInstance().LOCAL_DOWNLOAD_DIR,
DisClientConfig.getInstance().getHostList());
return fetcherMgr;
}
示例2: checkNetWork
import com.baidu.disconf.client.config.ConfigMgr; //导入依赖的package包/类
/**
* @return
*/
@Deprecated
protected boolean checkNetWork() {
//
// 如果网络不通则认为测试通过
//
try {
ConfigMgr.init();
} catch (Exception e) {
Assert.assertTrue(false);
}
if (!NetUtils.pingUrl(DisClientConfig.getInstance().getHostList().get(0) + DisconfWebPathMgr
.getZooHostsUrl
(DisClientSysConfig
.getInstance().CONF_SERVER_ZOO_ACTION))) {
return false;
}
return true;
}
示例3: getWatchMgr
import com.baidu.disconf.client.config.ConfigMgr; //导入依赖的package包/类
/**
* @throws Exception
*/
public static WatchMgr getWatchMgr(FetcherMgr fetcherMgr) throws Exception {
if (!ConfigMgr.isInit()) {
throw new Exception("ConfigMgr should be init before WatchFactory.getWatchMgr");
}
if (hosts == null || zooPrefix == null) {
synchronized(hostsSync) {
if (hosts == null || zooPrefix == null) {
// 获取 Zoo Hosts
try {
hosts = fetcherMgr.getValueFromServer(DisconfWebPathMgr.getZooHostsUrl(DisClientSysConfig
.getInstance()
.CONF_SERVER_ZOO_ACTION));
zooPrefix = fetcherMgr.getValueFromServer(DisconfWebPathMgr.getZooPrefixUrl(DisClientSysConfig
.getInstance
()
.CONF_SERVER_ZOO_ACTION));
WatchMgr watchMgr = new WatchMgrImpl();
watchMgr.init(hosts, zooPrefix, DisClientConfig.getInstance().DEBUG);
return watchMgr;
} catch (Exception e) {
LOGGER.error("cannot get watch module", e);
}
}
}
}
return null;
}
示例4: firstScan
import com.baidu.disconf.client.config.ConfigMgr; //导入依赖的package包/类
/**
* 第一次扫描,静态扫描 for annotation config
*/
protected synchronized void firstScan(List<String> scanPackageList) {
// 该函数不能调用两次
if (isFirstInit) {
LOGGER.info("DisConfMgr has been init, ignore........");
return;
}
//
//
//
try {
// 导入配置
ConfigMgr.init();
LOGGER.info("******************************* DISCONF START FIRST SCAN *******************************");
// registry
Registry registry = RegistryFactory.getSpringRegistry(applicationContext);
// 扫描器
scanMgr = ScanFactoryExt.getScanMgr(registry);
// 第一次扫描并入库
scanMgr.firstScan(scanPackageList);
// 获取数据/注入/Watch
disconfCoreMgr = DisconfCoreFactory.getDisconfCoreMgr(registry);
disconfCoreMgr.process();
//
isFirstInit = true;
LOGGER.info("******************************* DISCONF END FIRST SCAN *******************************");
} catch (Exception e) {
LOGGER.error(e.toString(), e);
}
}
示例5: firstScan
import com.baidu.disconf.client.config.ConfigMgr; //导入依赖的package包/类
/**
* 第一次扫描,静态扫描 for annotation config
*/
protected synchronized void firstScan(List<String> scanPackageList) {
// 该函数不能调用两次
if (isFirstInit) {
LOGGER.info("DisConfMgr has been init, ignore........");
return;
}
//
//
//
try {
// 导入配置
ConfigMgr.init();
LOGGER.info("******************************* DISCONF START FIRST SCAN *******************************");
// registry
Registry registry = RegistryFactory.getSpringRegistry(applicationContext);
// 扫描器
scanMgr = ScanFactory.getScanMgr(registry);
// 第一次扫描并入库
scanMgr.firstScan(scanPackageList);
// 获取数据/注入/Watch
disconfCoreMgr = DisconfCoreFactory.getDisconfCoreMgr(registry);
disconfCoreMgr.process();
//
isFirstInit = true;
LOGGER.info("******************************* DISCONF END FIRST SCAN *******************************");
} catch (Exception e) {
LOGGER.error(e.toString(), e);
}
}