public async Task<IEnumerable<Task>> Start(IComponentHostConfigurationProvider configurationProvider, CancellationTokenSource cancellationTokenSource) { IEnumerable<ComponentConfiguration> componentConfigurations = await configurationProvider.GetConfiguration(); _cancellationTokenSource = cancellationTokenSource; List<Task> tasks = new List<Task>(); foreach (ComponentConfiguration componentConfiguration in componentConfigurations) { await _logger.Information(String.Format("Starting {0} instances of {1}", componentConfiguration.Instances, componentConfiguration.ComponentIdentity)); for (int instance = 0; instance < componentConfiguration.Instances; instance++) { tasks.Add(StartTask(componentConfiguration.ComponentIdentity, componentConfiguration.RestartEvaluator)); } } return tasks; }
public async Task<IEnumerable<Task>> StartAsync(IComponentHostConfigurationProvider configurationProvider, CancellationTokenSource cancellationTokenSource) { IEnumerable<ComponentConfiguration> componentConfigurations = await configurationProvider.GetConfigurationAsync(); _cancellationTokenSource = cancellationTokenSource; List<Task> tasks = new List<Task>(); foreach (ComponentConfiguration componentConfiguration in componentConfigurations) { _logger?.Verbose( $"Starting {componentConfiguration.Instances} instances of {componentConfiguration.ComponentIdentity}"); for (int instance = 0; instance < componentConfiguration.Instances; instance++) { tasks.Add(StartTask(componentConfiguration.ComponentIdentity, componentConfiguration.Factory, componentConfiguration.RestartEvaluator)); } } return tasks; }
public async Task <IEnumerable <Task> > StartAsync(IComponentHostConfigurationProvider configurationProvider, CancellationTokenSource cancellationTokenSource) { IEnumerable <ComponentConfiguration> componentConfigurations = await configurationProvider.GetConfigurationAsync(); _cancellationTokenSource = cancellationTokenSource; List <Task> tasks = new List <Task>(); foreach (ComponentConfiguration componentConfiguration in componentConfigurations) { _logger?.LogTrace( "Starting {INSTANCES} instances of {NAME}", componentConfiguration.Instances, componentConfiguration.Name); for (int instance = 0; instance < componentConfiguration.Instances; instance++) { tasks.Add(StartTask(componentConfiguration.Name, componentConfiguration.Factory, componentConfiguration.RestartEvaluator)); } } return(tasks); }