Jfinal-scheduler is a simple Task Scheduler plug-in based on CRON4J and Scheduledthreadpoolexecutor implementations.
plugin [email protected] Address:
Https://git.oschina.net/myaniu/jfinal-scheduler
Very simplified now several convenient:
1) automatically set the number of scheduled threads according to the number of CPU cores
2) Tasks only need to implement Runnable interface
3) only cron expressions ( min. per minute )/fixed frequency (time unit fixed to seconds)/fixed delay (time unit fixed to seconds) supported
4) Support to start the task through the configuration file. Plug-ins only need one line of code to load.
How to use: Load the Jfinal-scheduler-1.2.0.jar plugin in the dist directory
Configuration in config configuration file for jfinal (encoded load)
@Override public void Configplugin (Plugins me) { Schedulerplugin sp = new Schedulerplugin (); Runnable task = new Testtask (); Executes//sp.fixeddelayschedule every 10 seconds (task, ten); Sp.fixedrateschedule (task, ten); Sp.cronschedule is executed every 1 minutes (Task, "* * * * *"); Me.add (SP);
Configuration in config configuration file for jfinal (load via config file)
@Override public void Configplugin (Plugins me) { Schedulerplugin sp = new Schedulerplugin ("Job.properties"); Me.add (SP);
Job.properties
#是否启用该任务testJob. enable=true# Task Class name testjob.class=com.wellbole.web.core.testtask# task type and expression #testjob.type=cron# testjob.expr=* * * * * #每隔10秒 (6 times per minute) perform testjob.type=fixedratetestjob.expr=10# once every 5 seconds (task one after the other) #testjob.type= fixeddelay#testjob.expr=5#job1.class=x.y.z.runnable# ...
Jfinal-scheduler Minimalist jfinal Task plugin