/// <summary> /// To complete the start up operation it is essential that the match maker be started correctly. /// </summary> /// <param name="ar"></param> private void OnMatchMakerStartUpComplete(IAsyncResult ar) { AcdAgentMatchMaker matchMaker = ar.AsyncState as AcdAgentMatchMaker; try { matchMaker.EndStartup(ar); _acdPlatform._platform.UnregisterForApplicationEndpointSettings(OnMatchMakerFound); _acdPlatform.RegisterForPlatformAutoProvisioningEvents(); _acdPlatform.UpdateAcdPlatformState(AcdPlatformState.Started); this.SetAsCompleted(null, false); } catch (RealTimeException ex) { _acdPlatform._logger.Log("AcdPlatform could not start the match maker", ex); _acdPlatform.BeginShutdown(_acdPlatform.OnPlatformShutdownComplete, null); this.SetAsCompleted(ex, false); return; } catch (InvalidOperationException ivoex) { _acdPlatform._logger.Log("AcdPlatform could not start the match maker", ivoex); _acdPlatform.BeginShutdown(_acdPlatform.OnPlatformShutdownComplete, null); this.SetAsCompleted(new OperationFailureException("AcdPlatform could not start the match maker", ivoex), false); return; } }
internal void Process() { //Call each portal and ask them to drain and terminate. if (_acdPlatform._portals.Count != 0) { _acdPlatform._numberOfPortals = _acdPlatform._portals.Count; foreach (AcdPortal portal in _acdPlatform._portals) { portal.BeginShutdown(OnPortalShutdownComplete, portal); } } else { if (_acdPlatform._matchMaker != null) { _acdPlatform._matchMaker.BeginShutdown(OnMatchMakerShutdownComplete, null); } else { //Log all our events to the event log. if (_acdPlatform._logger != null) { _acdPlatform._logger.ShutDown(); } if (_acdPlatform.CollaborationPlatform != null) { _acdPlatform.CollaborationPlatform.BeginShutdown(OnCollabPlatformShutdownComplete, null); } else { _acdPlatform.UpdateAcdPlatformState(AcdPlatformState.Terminated); _acdPlatform._listOfShutdownAsyncResults.ForEach(stdwnar => stdwnar.SetAsCompleted(null, false)); this.SetAsCompleted(null, false); } } } }