本文整理匯總了Java中com.baidu.disconf.client.config.ConfigMgr.isInit方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigMgr.isInit方法的具體用法?Java ConfigMgr.isInit怎麽用?Java ConfigMgr.isInit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baidu.disconf.client.config.ConfigMgr
的用法示例。
在下文中一共展示了ConfigMgr.isInit方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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;
}