public CommandProcessor(BlockingCollection<Job> allJobs, Scheduler scheduler, JobQueue jobQueue, QueueProcessor queueProcessor)
 {
     _allJobs = allJobs;
     _scheduler = scheduler;
     _jobQueue = jobQueue;
     _queueProcessor = queueProcessor;
 }
예제 #2
0
 public QueueProcessor(int maxConcurrentJobs, JobQueue jobQueue)
 {
     _semaphore = new SemaphoreSlim(maxConcurrentJobs);
     _jobQueue = jobQueue;
     Task.Factory.StartNew(TaskStartLoop, _cancellationTokenSource.Token);
     _jobQueue.JobAdded += JobQueueOnJobAdded;
 }
예제 #3
0
 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();
         }
     }
 }
예제 #4
0
 public DisplayService(BlockingCollection<Job> allTasks, JobQueue jobQueue)
 {
     _allTasks = allTasks;
     _jobQueue = jobQueue;
     Task.Factory.StartNew(DisplayLoop, _cancellationTokenSource.Token);
 }
예제 #5
0
 public Scheduler(JobQueue jobQueue)
 {
     _jobQueue = jobQueue;
 }