public static bool GetAdapterScript(string pluginname, out string scriptText)
 {
     try
     {
         if (WcfGlobal.IsRootMNode)
         {
             MongoHelper <PluginServiceScript> pshelper = new MongoHelper <PluginServiceScript>(WcfGlobal.MongoConnStr, MonitorPlatformManage.dbName);
             PluginServiceScript psScript = pshelper.Find(Query.EQ("pluginname", pluginname));
             scriptText = psScript.script;
             return(true);
         }
         else
         {
             string val = SuperClient.CreateDataClient().RootRequest("adapter_getscript", JsonConvert.SerializeObject(pluginname));
             scriptText = JsonConvert.DeserializeObject <String>(val);
             return(true);
         }
     }
     catch (Exception err)
     {
         CoreFrame.Common.MiddlewareLogHelper.WriterLog(err.Message + err.StackTrace);
         scriptText = null;
         return(false);
     }
 }
예제 #2
0
        public string CreateDataClient()
        {
            ClientLink cl = SuperClient.CreateDataClient();

            while (cl.ClientObj.ClientID == null)//解决并发问题,因为创建连接是一个异步过程,等创建成功后再返回ClientID
            {
                Thread.Sleep(400);
            }

            return(cl.ClientObj.ClientID);
        }