public CommandProcessor(BlockingCollection<Job> allJobs, Scheduler scheduler, JobQueue jobQueue, QueueProcessor queueProcessor) { _allJobs = allJobs; _scheduler = scheduler; _jobQueue = jobQueue; _queueProcessor = queueProcessor; }
public QueueProcessor(int maxConcurrentJobs, JobQueue jobQueue) { _semaphore = new SemaphoreSlim(maxConcurrentJobs); _jobQueue = jobQueue; Task.Factory.StartNew(TaskStartLoop, _cancellationTokenSource.Token); _jobQueue.JobAdded += JobQueueOnJobAdded; }
private static void Main(string[] args) { var maxConcurrentJobs = GetMaxConcurrentJobs(); var allTaskList = new BlockingCollection<Job>(); var socketServer = new SocketServer(IPAddress.Loopback, 6666); var jobQueue = new JobQueue(); var scheduler = new Scheduler(jobQueue); using (var queueProcessor = new QueueProcessor(maxConcurrentJobs, jobQueue)) { var commandProcessor = new CommandProcessor(allTaskList, scheduler, jobQueue, queueProcessor); using (var dispatcher = new CommandDispatcherService(socketServer, commandProcessor)) using (var display = new DisplayService(allTaskList, jobQueue)) { Console.ReadLine(); } } }
public DisplayService(BlockingCollection<Job> allTasks, JobQueue jobQueue) { _allTasks = allTasks; _jobQueue = jobQueue; Task.Factory.StartNew(DisplayLoop, _cancellationTokenSource.Token); }
public Scheduler(JobQueue jobQueue) { _jobQueue = jobQueue; }