Jfinal-scheduler Minimalist jfinal Task plugin

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.