Beispiel #1
0
 private void RemoveAndReturnJobResult(ClientJob clientJob, JobResult jobResult)
 {
     SendResult(jobResult);
     Jobs.Remove(clientJob.Job.Id);
     OnJobRemovedEvent(new ClientJobEventArgs(clientJob));
     if (Jobs.Count < NumberOfParallelJobs)
     {
         _allJobsDone.Set();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Tries to get a new job and starts processing it
        /// </summary>
        private bool GetAndStartJob()
        {
            var nextJob = GetJob(_clientInfo.Id);

            if (nextJob != null)
            {
                var clientJob = new ClientJob(nextJob);
                Jobs.TryAdd(clientJob.Job.Id, clientJob);
                OnJobAddedEvent(new ClientJobEventArgs(clientJob));
                Task.Factory.StartNew(ProcessJob, clientJob);
                return(true);
            }
            return(false);
        }
 public ClientJobEventArgs(ClientJob clientJob)
 {
     ClientJob = clientJob;
 }