public Worker(Type jobType, JobSetup setup, IContainerFactory containerFactory, ILoggerFactory loggerFactory) { this.jobType = jobType; this.setup = setup; this.containerFactory = containerFactory; this.thread = new Thread(Run) { IsBackground = true, Name = "Worker: " + jobType.FullName }; this.logger = loggerFactory.GetLogger(jobType, setup.JobId); }
public Guid AddJob <TJob>(JobSetup jobSetup) { if (jobSetup.JobId == Guid.Empty) { jobSetup.JobId = Guid.NewGuid(); } var state = new Worker(typeof(TJob), jobSetup, this.containerFactory, this.loggerFactory); this.jobs[jobSetup.JobId] = state; state.Start(); return(jobSetup.JobId); }
public Guid AddJob <TJob>(JobSetup jobSetup) { if (this._disposed) { throw new ObjectDisposedException("Scheduler", "Cannot schedule new jobs."); } if (jobSetup.JobId == Guid.Empty) { jobSetup.JobId = Guid.NewGuid(); } var state = new Worker(typeof(TJob), jobSetup, this.containerFactory, this.loggerFactory); this.jobs[jobSetup.JobId] = state; state.Start(); return(jobSetup.JobId); }