How can I set the number of threads in the Quartz.NET threadpool?

It depends a bit on the pool you're using and the config file the scheduler is reading. But if you are using the standard SimpleThreadPool.cs then the amount of threads can be configured inside the quartz.config file, by default 10 threads are created:

alt text


You can do this programmatically with the code below if you don't want to rely on the external quartz.config file for whatever reason:

    var properties = new NameValueCollection { {"quartz.threadPool.threadCount", "1"} };

    var schedulerFactory = new StdSchedulerFactory(properties);
    var scheduler = schedulerFactory.GetScheduler();

I agree with the comments in the accepted answer though that in this case you probably want to use [DisallowConcurrentExecutionAttribute] on your IJob class instead.