Esempio n. 1
0
        public void CreateWorker(string id, string puppetMasterUrl, string serviceUrl, string entryUrl)
        {
            Logger.LogInfo("[WORKER] " + id + " " + puppetMaster + " " + serviceUrl + " " + entryUrl);
            if (puppetMasterUrl != "")
            {
                Logger.LogInfo("CONTACTING PUPPET MASTER");
                try
                {
                    IPuppetMaster pm = (IPuppetMaster)Activator.GetObject(typeof(IPuppetMaster), puppetMasterUrl);
                    pm.CreateWorker(id, puppetMasterUrl, serviceUrl, entryUrl);
                }
                catch (Exception ex)
                {
                    if (ex is RemotingException || ex is SocketException)
                    {
                        Logger.LogErr("Puppet Master @ " + puppetMasterUrl + " is down. --> " + ex.Message);
                    }
                }
            }
            else
            {
                IPuppetMaster p = new PM();
                p.CreateWorker(id, puppetMasterUrl, serviceUrl, entryUrl);
            }

            Logger.LogInfo("Waiting 1 second for node start");
            Thread.Sleep(1000);
        }
        public void CreateWorker(string id, string puppetMasterUrl, string serviceUrl, string entryUrl)
        {
            Logger.LogInfo("[WORKER] " + id + " " + puppetMaster + " " + serviceUrl + " " + entryUrl);
            if (puppetMasterUrl != "") {
                Logger.LogInfo("CONTACTING PUPPET MASTER");
                try
                {
                    IPuppetMaster pm = (IPuppetMaster)Activator.GetObject(typeof(IPuppetMaster), puppetMasterUrl);
                    pm.CreateWorker(id, puppetMasterUrl, serviceUrl, entryUrl);
                }
                catch (Exception ex)
                {
                    if (ex is RemotingException || ex is SocketException)
                    {
                        Logger.LogErr("Puppet Master @ " + puppetMasterUrl + " is down. --> " + ex.Message);
                    }
                }
            }
            else
            {
                IPuppetMaster p = new PM();
                p.CreateWorker(id, puppetMasterUrl, serviceUrl, entryUrl);
            }

            Logger.LogInfo("Waiting 1 second for node start");
            Thread.Sleep(1000);
        }