public int StartJob(string location, string args) { var id = 0; buffer.Run(all => { if (all.Count < jobProcessor.GetLimit()) { var job = jobProvider.GetJob(location, args, Clients.Caller); id = jobProcessor.Process(job, all); } }); return(id); }
private void FinalAll(Func <KeyValuePair <int, JobContent>, bool> predicate) { buffer.Run(all => { var removable = all.Where(predicate).ToList(); foreach (var pair in removable) { FinalJob(pair.Value); all.Remove(pair.Key); } }); }