We are using a task scheduler in our smartfox extension and we have 6 different schedule tasks. With each extension request, smartfox' active thread count increase by the number of threadpool size we set for each scheduleexecutor service. Looks like we need to get 1 scheduler centralized and reference to from other classes. We just dont know how to keep a reference to it and create a new task without populating active thread pool with new threads. Please let me know how to centralize the scheduler and keep reference to it.
Asked
Active
Viewed 262 times
1 Answers
0
You can replace the scheduleexecutors with a Quartz scheduler - you can set the maximum number of threads in its threadpool via the org.quartz.threadPool.threadCount
config property.
The easiest way to make a reference to the scheduler available in all of your threads, e.g.
public class SchedulerWrapper {
private static Scheduler scheduler;
public static void addJob(JobDetail jobDetail) {
scheduler.addJob(jobDetail, true);
}
}

Zim-Zam O'Pootertoot
- 17,888
- 4
- 41
- 69
-
Would this cause any slowing-down during the game? It is a multiplayer poker game btw. thanks – Leon Apr 23 '13 at 15:00
-
It shouldn't cause any slowing down so long as you set the threadpool to an appropriate size, e.g. one thread per player plus one thread for the dealer. – Zim-Zam O'Pootertoot Apr 23 '13 at 15:05