private void StartProcesses() { foreach (string opx in config.Keys) { ConfigInfo c; config.TryGetValue(opx, out c); ArrayList urls = c.Urls; foreach (string url in urls) { //For each url contact the PCS in the ip of that url and tell him to create a replica string urlOnly = getIPFromUrl(url); PCSServices pcs = getPCSServices("tcp://" + urlOnly + ":" + PCS_PORT + "/" + PCSSERVER_NAME); //Create replica pcs.createOperator(getPortFromUrl(url), getNameFromUrl(url)); //Connection with the operator RepServices rs = getRepServices(url); if (!repServices.ContainsKey(opx)) { repServices.Add(opx, new ArrayList()); } //Save replica service ArrayList array; repServices.TryGetValue(opx, out array); array.Add(rs); } } }
public RepServices getRepServices(string url) { //Getting the RepServices object RepServices obj = (RepServices)Activator.GetObject(typeof(RepServices), url); return(obj); }
//Gets the receiving urls of each replica, i.e the urls which will send to the each replica private void GetUrlsFrom() { foreach (string operator_id in config.Keys) { ArrayList array; repServices.TryGetValue(operator_id, out array); for (int i = 0; i < array.Count; i++) { RepServices repS = (RepServices)array[i]; RepInfo ri = repS.getRepInfoFromRep(); ArrayList getFrom = getFromUrls(ri.OperatorId); ri.ReceiveInfoUrls = getFrom; repS.updateRepInfo(ri); } } RepInfos.Clear(); foreach (string operator_id in config.Keys) { ArrayList array; repServices.TryGetValue(operator_id, out array); for (int i = 0; i < array.Count; i++) { RepServices repS = (RepServices)array[i]; RepInfo ri = repS.getRepInfoFromRep(); RepInfos.Add(ri); } } }
public void Crash(string opx, string rep) { RepServices repServ = getReplicaServiceFromProcessname(opx, rep); //Asynchronous call without callback // Create delegate to remote method AsyncDelegate RemoteDel = new AsyncDelegate(repServ.Crash); // Call delegate to remote method IAsyncResult RemAr = RemoteDel.BeginInvoke(null, null); SendToLog("Crash " + opx + " " + rep); }
public void Interval(string operator_id, string x_ms) { ArrayList array; repServices.TryGetValue(operator_id, out array); for (int i = 0; i < array.Count; i++) { RepServices repS = (RepServices)array[i]; //Asynchronous call without callback // Create delegate to remote method IntervalAsyncDelegate RemoteDel = new IntervalAsyncDelegate(repS.Interval); // Call delegate to remote method IAsyncResult RemAr = RemoteDel.BeginInvoke(x_ms, null, null); } SendToLog("Interval " + operator_id + " " + x_ms); }
public void Status() { foreach (string operator_id in repServices.Keys) { ArrayList array; repServices.TryGetValue(operator_id, out array); for (int i = 0; i < array.Count; i++) { RepServices repS = (RepServices)array[i]; //Asynchronous call without callback // Create delegate to remote method AsyncDelegate RemoteDel = new AsyncDelegate(repS.Status); // Call delegate to remote method IAsyncResult RemAr = RemoteDel.BeginInvoke(null, null); } } SendToLog("Status"); }