private void RemoveAndReturnJobResult(ClientJob clientJob, JobResult jobResult) { SendResult(jobResult); Jobs.Remove(clientJob.Job.Id); OnJobRemovedEvent(new ClientJobEventArgs(clientJob)); if (Jobs.Count < NumberOfParallelJobs) { _allJobsDone.Set(); } }
/// <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; }