Пример #1
0
        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);
        }