public ITestState Start() { _threadPoolCounter = new ThreadPoolCounter(); PipeFactory <IResult> pipeFactory = new PipeFactory <IResult>(); _aggregator = new PipelineDataAggregator(_settings.Aggregators, pipeFactory); _aggregator.Start(); _globalCounters = GlobalCounters.CreateDefault(); _errorHandler = new ErrorHandler(); _limit = new LimitsHandler(_settings.Limits); _threading = _settings.Threading; _state = new TestState(_timer, _globalCounters, _threadPoolCounter); _speed = PriorityStrategyFactory.Create(_settings.Speeds, _timer); _speed.Setup(_state); IIterationContextFactory iterationContextFactory = CreateIterationContextFactory(); IScenarioHandlerFactory scenarioHandlerFactory = CreateScenarioHandlerFactory(); ISchedulerFactory schedulerFactory = CreateSchedulerFactory(); IDataCollectorFactory dataCollectorFactory = CreateDataCollectorFactory(pipeFactory, _threadPoolCounter); IScenarioThreadFactory scenarioThreadFactory = CreateScenarioThreadFactory(); IThreadFactory threadFactory = new ScenarioThreadFactory( iterationContextFactory, scenarioHandlerFactory, schedulerFactory, dataCollectorFactory, scenarioThreadFactory ); _pool = new ThreadPool(threadFactory, _threadPoolCounter); InitialThreadingSetup(); _timer.Start(); // This line also releases Worker-Threads from wait in IPrewait return(_state); }
/// <summary> /// Sets created worker-thread count controlling strategy. /// </summary> /// <param name="threadingStrategy">threading strategy to use</param> /// <returns></returns> public StrategyBuilder SetThreading(IThreadingStrategy threadingStrategy) { Threading = threadingStrategy; return(this); }