Ejemplo n.º 1
0
        public static void StartNewManager(out string friendlyname)
        {
            NumberOfManagersToStart++;

            var portNumber =
                Settings.Default.ManagerEndpointPortNumberStart + (NumberOfManagersToStart - 1);
            var allowedDowntimeSeconds = Settings.Default.AllowedDowntimeSeconds;

            Uri uri;

            var copiedManagerConfigurationFile =
                CopyManagerConfigurationFile(ManagerConfigurationFile,
                                             NumberOfManagersToStart,
                                             portNumber,
                                             allowedDowntimeSeconds,
                                             out uri);

            CopiedManagerConfigurationFiles.Add(uri,
                                                copiedManagerConfigurationFile);

            var appDomainManagerTask =
                new AppDomainManagerTask(_buildMode,
                                         DirectoryManagerAssemblyLocationFullPath,
                                         copiedManagerConfigurationFile,
                                         Settings.Default.ManagerAssemblyName);

            AppDomainManagerTasks.AddOrUpdate(appDomainManagerTask.GetAppDomainUniqueId(),
                                              appDomainManagerTask,
                                              (s, task) => appDomainManagerTask);

            RoundRobin.AddHost(uri);

            Logger.DebugWithLineNumber("Start: AppDomainManagerTask.StartTask");

            appDomainManagerTask.StartTask(new CancellationTokenSource());

            Logger.DebugWithLineNumber("Finished: AppDomainManagerTask.StartTask");

            friendlyname = appDomainManagerTask.GetAppDomainUniqueId();
        }