예제 #1
0
		public DisconfFileCoreProcessorImpl(WatchMgr watchMgr, FetcherMgr fetcherMgr, Registry registry)
		{

			this.fetcherMgr = fetcherMgr;
			this.watchMgr = watchMgr;
			this.registry = registry;
		}
예제 #2
0
		public DisconfCoreMgrImpl(WatchMgr watchMgr, FetcherMgr fetcherMgr, Registry registry)
		{

			this.watchMgr = watchMgr;
			this.fetcherMgr = fetcherMgr;
			this.registry = registry;

			//
			// 在这里添加好配置项、配置文件的处理器
			//
			DisconfCoreProcessor disconfCoreProcessorFile = DisconfCoreProcessorFactory.getDisconfCoreProcessorFile(watchMgr, fetcherMgr, registry);
			disconfCoreProcessorList.Add(disconfCoreProcessorFile);

			DisconfCoreProcessor disconfCoreProcessorItem = DisconfCoreProcessorFactory.getDisconfCoreProcessorItem(watchMgr, fetcherMgr, registry);
			disconfCoreProcessorList.Add(disconfCoreProcessorItem);
		}
예제 #3
0
		/// <exception cref="Exception"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static WatchMgr getWatchMgr(com.baidu.disconf.client.fetcher.FetcherMgr fetcherMgr) throws Exception
		public static WatchMgr getWatchMgr(FetcherMgr fetcherMgr)
		{

			if (!ConfigMgr.Init)
			{
				throw new Exception("ConfigMgr should be init before WatchFactory.getWatchMgr");
			}

			if (string.ReferenceEquals(hosts, null) || string.ReferenceEquals(zooPrefix, null))
			{
				lock (hostsSync)
				{
					if (string.ReferenceEquals(hosts, null) || string.ReferenceEquals(zooPrefix, null))
					{

						// 获取 Zoo Hosts
						try
						{

							hosts = fetcherMgr.getValueFromServer(DisconfWebPathMgr.getZooHostsUrl(DisClientSysConfig.Instance.CONF_SERVER_ZOO_ACTION));

							zooPrefix = fetcherMgr.getValueFromServer(DisconfWebPathMgr.getZooPrefixUrl(DisClientSysConfig.Instance.CONF_SERVER_ZOO_ACTION));

							WatchMgr watchMgr = new WatchMgrImpl();
							watchMgr.init(hosts, zooPrefix, DisClientConfig.Instance.DEBUG);

							return watchMgr;

						}
						catch (Exception e)
						{

							LOGGER.error("cannot get watch module", e);

						}
					}
				}
			}

			return null;
		}