Beispiel #1
0
        private void LaunchSingleSessionFromDB()
        {
            BusinessModelManager manager = new BusinessModelManager();
            List <Guid>          runningSessionGroups = manager.GetActiveSessionGroupUniqueIds();

            // If we are self hosting, use the IMigrationService interface
            // to start some sessions before trying to list the active ones.
            if (!runningSessionGroups.Contains(SingleSessionStartInfo.SessionGroupId))
            {
                return;
            }

            if (m_commandSwitch.CommandSwitchSet)
            {
                Configuration configuration = manager.LoadConfiguration(SingleSessionStartInfo.SessionGroupId);
                preAuthorizeRules(configuration);
            }

            m_pipeProxy.StartSingleSessionInSessionGroup(SingleSessionStartInfo.SessionGroupId, SingleSessionStartInfo.SessionId);

            while (true)
            {
                try
                {
                    runningSessionGroups.Clear();
                    runningSessionGroups.AddRange(m_pipeProxy.GetRunningSessionGroups());

                    // uncomment the following lines for richer debugging message
                    // Console.WriteLine(String.Format("Received {0} entries", runningSessionGroups.Count));
                    //foreach (Guid guid in runningSessionGroups)
                    //{
                    //    Console.WriteLine(guid.ToString());
                    //}

                    if (runningSessionGroups.Count() == 0)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    // Ugly, but this approach lets us start the test app
                    // before the endpoint is ready to service requests.
                    Console.WriteLine("Error: {0}", e.Message);

                    // re-initialize proxy
                    InitializeProxy();
                }

                Thread.Sleep(RunningSessionPollingIntervalMillisec);
            }
        }