Yes, @Scheduled is a way to let the scheduler know how many items will be scheduled. Realistically they don’t each need their own thread since they will likely happen at different times. I don’t want a single thread because multiple items are likely to be scheduled at the same time - like midnight. If you use a Timer task then the Timer task that runs really needs to spawn a new thread to do the actual work. Otherwise it runs the risk of tying up the scheduler for a long period of time. I figure that with a max of 5 threads that shouldn’t be a problem.
Also, the WatchManager isn’t a plugin and registers itself with the scheduler. It can be watching multiple files and each interval it will check all the files. I am assuming that eventually the FileConfigurationMonitor will be modified to use the WatchManager, and if we implement support for multiple configuration files and with multiple script files the number of things being monitored could cause the WatchManager to take a few seconds on each interval. So if the WatchManager is active and there are any other scheduled items I would want at least 2 threads. Note that we can tune the algorithm for how many threads we actually create. Ralph > On Nov 16, 2015, at 10:30 PM, Remko Popma <[email protected]> wrote: > > I only read the commit emails on my phone, so my understanding is still a bit > superficial, but I noticed each @Scheduled element gets its own thread (up to > max 5 threads, after that they start sharing). Why not use just one thread > that executives all scheduled/submitted tasks? > > Remko > > Sent from my iPhone > >> On 2015/11/17, at 12:25, Ralph Goers <[email protected]> wrote: >> >> I have checked in a CronTriggeringPolicy for the RollingFileAppenders on >> branch LOG4J2-89. It also introduces the ConfigurationScheduler, a more >> generic version of the ScheduledExecutorService I previously added. I am >> envisioning that the scheduler can be used for more time-based tasks. >> Plugins that use the Scheduler should be annotated with the Scheduled >> annotation to help calculate the number of threads the scheduler should >> create. >> >> Please take a look at the branch and let me know what you think. >> >> Ralph >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
