private void instantiateServer(String sId, String sURL, String sMaxFaults, String sMinDelay, String sMaxDelay) { String args = sId + " " + sURL + " " + sMaxFaults + " " + sMinDelay + " " + sMaxDelay; var creationResult = serviceCreator.createServerInstance(args); logs.Text += (creationResult + "\n"); IServer s = (IServer)Activator.GetObject( typeof(IServer), sURL ); //Inform new servers about created ones foreach (String key in serverURLs.Keys) { s.registerNewServer(key, serverURLs[key]); } //Inform other servers about new one foreach (IServer server in servers.Values) { server.registerNewServer(sId, sURL); } foreach (Room r in rooms) { s.AddRoom(r.location, r.name, r.capacity); } servers.Add(sId, s); serverURLs.Add(sId, sURL); }
private void addRoom(String location, String capacity, String room) { int cp = Int32.Parse(capacity); rooms.Add(new Room(room, location, cp)); foreach (String key in servers.Keys) { IServer s = servers[key]; Thread thread = new Thread(() => { try { s.AddRoom(location, room, cp); } catch (Exception e) { appendMessage("Can not notify server about new room: " + key); } }); thread.Start(); } }
public void AddNewRoom(int seats, string RoomNo) { server.AddRoom(seats, RoomNo); }