コード例 #1
0
        private Task TransitionTo(NodeRole newRole, IDictionary <string, string[]> hostArguments)
        {
            var startTasks = new ConcurrentBag <Task>();

            Parallel.ForEach(_appStarters, starter =>
            {
                AppFunc chain = null;

                if (Chains.ContainsKey(starter.Chain))
                {
                    chain = Chains[starter.Chain];
                }

                chain = chain ?? starter.GetDefaultChain(GetAppFunctionBuilder(starter.Chain), Environment, ApplicationEnvironment);

                if (chain != null)
                {
                    startTasks.Add(starter.BringToState(chain, Environment, ApplicationEnvironment, newRole, hostArguments));
                }
            });

            return(Task.WhenAll(startTasks));
        }