/// <summary> /// Creates an in memory job store (<see cref="RAMJobStore" />) /// The thread priority is set to Thread.NORM_PRIORITY /// </summary> /// <param name="maxThreads">The number of threads in the thread pool</param> public virtual void CreateVolatileScheduler(int maxThreads) { IThreadPool threadPool = new DefaultThreadPool(); threadPool.Initialize(); IJobStore jobStore = new RAMJobStore(); CreateScheduler(threadPool, jobStore); }
public async void Initialize() { _generalPool = new DefaultThreadPool(); _generalPool.MaxConcurency = AppConfiguration.Instance.MaxConcurencyThreadPool; _generalPool.Initialize(); DirectSchedulerFactory .Instance .CreateScheduler("General Scheduler", "GeneralScheduler", _generalPool, new RAMJobStore()); _generalScheduler = await DirectSchedulerFactory.Instance.GetScheduler("General Scheduler"); }
/// <summary> /// Creates an in memory job store (<see cref="RAMJobStore" />) /// </summary> /// <param name="maxConcurrency">The number of allowed concurrent running tasks.</param> public virtual void CreateVolatileScheduler(int maxConcurrency) { var threadPool = new DefaultThreadPool { MaxConcurrency = maxConcurrency }; threadPool.Initialize(); IJobStore jobStore = new RAMJobStore(); CreateScheduler(threadPool, jobStore); }
private static IScheduler CreateScheduler(string customerCode) { var ramJobStore = new RAMJobStore(); var schedulerResources = new QuartzSchedulerResources { JobRunShellFactory = new StdJobRunShellFactory(), JobStore = ramJobStore, Name = $"TasksScheduler_{customerCode}" }; var threadPool = new DefaultThreadPool(); threadPool.Initialize(); schedulerResources.ThreadPool = threadPool; var quartzScheduler = new QuartzScheduler(schedulerResources, TimeSpan.Zero); ITypeLoadHelper loadHelper; try { loadHelper = ObjectUtils.InstantiateType <ITypeLoadHelper>(typeof(SimpleTypeLoadHelper)); } catch (Exception e) { throw new SchedulerConfigException("Unable to instantiate type load helper: {0}".FormatInvariant(e.Message), e); } loadHelper.Initialize(); ramJobStore.Initialize(loadHelper, quartzScheduler.SchedulerSignaler); var standartScheduler = new StdScheduler(quartzScheduler); schedulerResources.JobRunShellFactory.Initialize(standartScheduler); quartzScheduler.Initialize(); SchedulerRepository schedRep = SchedulerRepository.Instance; schedRep.Bind(standartScheduler); return(standartScheduler); }