public void Working(IJob job) { if (job != null) { job.DoJob(); } }
public void DoWork(IJob job) { if (job != null) { job.DoJob(); } }
private Task CreateTask() { return(new Task(() => { while (!_isCanceled) { try { token.ThrowIfCancellationRequested(); StartProcess(); JobResult(_job.DoJob()); SpinWait.SpinUntil(() => false, NextInterval()); } catch (OperationCanceledException) { break; } catch (System.Exception ex) { var isRetry = CheckRetry(); if (!isRetry.Item1) { AfterExceptionCanceled(ex); throw; } OnRetry(isRetry.Item2); SpinWait.SpinUntil(() => false, RetryInterval()); } } AfterCanceled(); }, token)); }
public void DoJob() { if (_job != null) { _job.DoJob(); } }
static void Main(string[] args) { IEmployee myEmployee = Factory.CreateIEmployee(); myEmployee.Name = "Mert"; myEmployee.Surname = "Yavuz"; myEmployee.Age = 25; IJob job = Factory.CreateIJob(); job.Employee = myEmployee; job.JobName = "Doing an IoC presentation"; job.DoJob(2); job.DoJob(1); job.FinishJob(); }
public void ConsumeJobs() { while (true) { if (_cancellationToken.IsCancellationRequested) { return; } if (!this._jobQueue.Empty()) { Task.Run(() => { IJob job = null; if (this._jobQueue.TryDequeue(out job)) { try { _jobManager.JobStarted(job.JobId); job.DoJob(_cancellationToken); _jobManager.JobCompleted(job.JobId); } catch (Exception e) { Console.WriteLine(e.Message); _jobManager.JobFailed(job.JobId); } } }); } else { Thread.Sleep(500); } } }
private void doJob(JobItem item, bool nextSchedule = true) { if (item.Pending == true) { return; } var type = Type.GetType(item.AssemblyQualifiedName); if (type == null) { _jobItems.Remove(item); } else { IJob job = (IJob)type.Assembly.CreateInstance(type.FullName); job.DoJob(); if (nextSchedule) { item.Schedule = job.GetScheduleToNextTurn(item.Schedule); } job.Dispose(); } }
public void DoWork(IJob job) { job?.DoJob(); }
public void PlusName(int i) { job.DoJob(i); }
public void ReName(int i) { job.DoJob(i); }