Пример #1
0
        public MasterAPI(string[] pcsUrls)
        {
            Servers         = new ConcurrentDictionary <string, IServer>();
            ServerUrls      = "";
            ServerIdsToUrls = new ConcurrentDictionary <string, string>();

            Clients = new ConcurrentDictionary <string, IClient>();

            PCSs = new ConcurrentDictionary <string, ProcessCreationService>();
            foreach (string url in pcsUrls)
            {
                PCSs.TryAdd(BaseUrlExtractor.Extract(url), (ProcessCreationService)Activator.GetObject(typeof(ProcessCreationService), url));
            }

            _startProcessDelegate = new StartProcessDelegate(StartProcess);

            _serverDelegate         = new ServerDelegate(ServerSync);
            _clientDelegate         = new ClientDelegate(ClientSync);
            _addRoomDelegate        = new AddRoomDelegate(AddRoomSync);
            _statusDelegate         = new StatusDelegate(StatusSync);
            _crashDelegate          = new CrashDelegate(CrashSync);
            _freezeDelegate         = new FreezeDelegate(FreezeSync);
            _unfreezeDelegate       = new UnfreezeDelegate(UnfreezeSync);
            _shutDownSystemDelegate = new ShutDownSystemDelegate(ShutDownSystemSync);

            _checkNodeStatusDelegate = new CheckNodeStatus(CheckNode);

            _nodesCreated = 0;
        }
Пример #2
0
 private void AsyncCallCrash(CrashDelegate caller, string processname)
 {
     caller.BeginInvoke(processname, asyncResult =>
     {
         AsyncResult ar          = (AsyncResult)asyncResult;
         CrashDelegate remoteDel = (CrashDelegate)ar.AsyncDelegate;
         remoteDel.EndInvoke(asyncResult);
     }, null);
 }