コード例 #1
0
		/// <summary>
		/// 新建监控
		/// </summary>
		/// <exception cref="Exception"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private String makeMonitorPath(com.baidu.disconf.core.common.constants.DisConfigTypeEnum disConfigTypeEnum, com.baidu.disconf.client.common.model.DisConfCommonModel disConfCommonModel, String key, String value) throws Exception
		private string makeMonitorPath(DisConfigTypeEnum disConfigTypeEnum, DisConfCommonModel disConfCommonModel, string key, string value)
		{

			// 应用根目录
			/*
			    应用程序的 Zoo 根目录
			*/
			string clientRootZooPath = ZooPathMgr.getZooBaseUrl(zooUrlPrefix, disConfCommonModel.App, disConfCommonModel.Env, disConfCommonModel.Version);
			ZookeeperMgr.Instance.makeDir(clientRootZooPath, ZooUtils.Ip);

			// 监控路径
			string monitorPath;
			if (disConfigTypeEnum.Equals(DisConfigTypeEnum.FILE))
			{

				// 新建Zoo Store目录
				string clientDisconfFileZooPath = ZooPathMgr.getFileZooPath(clientRootZooPath);
				makePath(clientDisconfFileZooPath, ZooUtils.Ip);

				monitorPath = ZooPathMgr.joinPath(clientDisconfFileZooPath, key);

			}
			else
			{

				// 新建Zoo Store目录
				string clientDisconfItemZooPath = ZooPathMgr.getItemZooPath(clientRootZooPath);
				makePath(clientDisconfItemZooPath, ZooUtils.Ip);
				monitorPath = ZooPathMgr.joinPath(clientDisconfItemZooPath, key);
			}

			// 先新建路径
			makePath(monitorPath, "");

			// 新建一个代表自己的临时结点
			makeTempChildPath(monitorPath, value);

			return monitorPath;
		}
コード例 #2
0
		/// <summary>
		/// 监控路径,监控前会事先创建路径,并且会新建一个自己的Temp子结点
		/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void watchPath(com.baidu.disconf.client.core.processor.DisconfCoreProcessor disconfCoreMgr, com.baidu.disconf.client.common.model.DisConfCommonModel disConfCommonModel, String keyName, com.baidu.disconf.core.common.constants.DisConfigTypeEnum disConfigTypeEnum, String value) throws Exception
		public virtual void watchPath(DisconfCoreProcessor disconfCoreMgr, DisConfCommonModel disConfCommonModel, string keyName, DisConfigTypeEnum disConfigTypeEnum, string value)
		{

			// 新建
			string monitorPath = makeMonitorPath(disConfigTypeEnum, disConfCommonModel, keyName, value);

			// 进行监控
			NodeWatcher nodeWatcher = new NodeWatcher(disconfCoreMgr, monitorPath, keyName, disConfigTypeEnum, new DisconfSysUpdateCallback(), debug);
			nodeWatcher.monitorMaster();
		}