本文整理匯總了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);
}
}