/**
* Copyright (c) 2011-2016, James Zhan 詹波 (jfinal@126.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jfinal.plugin.cron4j;
import it.sauronsoftware.cron4j.ProcessTask;
import it.sauronsoftware.cron4j.Scheduler;
import java.util.ArrayList;
import java.util.List;
import com.jfinal.kit.Prop;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.IPlugin;
import it.sauronsoftware.cron4j.Task;
/**
* Cron4jPlugin 封装 cron4j,使用 cron 表达式调试 Task 执行
*
* cron 表达式由五部分组成:分 时 天 月 周
* 分 :从 0 到 59
* 时 :从 0 到 23
* 天 :从 1 到 31,字母 L 可以表示月的最后一天
* 月 :从 1 到 12,可以别名:jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov" and "dec"
* 周 :从 0 到 6,0 表示周日,6 表示周六,可以使用别名: "sun", "mon", "tue", "wed", "thu", "fri" and "sat"
*
* 数字 n:表示一个具体的时间点,例如 5 * * * * 表示 5 分这个时间点时执行
* 逗号 , :表示指定多个数值,例如 3,5 * * * * 表示 3 和 5 分这两个时间点执行
* 减号 -:表示范围,例如 1-3 * * * * 表示 1 分、2 分再到 3 分这三个时间点执行
* 星号 *:表示每一个时间点,例如 * * * * * 表示每分钟执行
* 除号 /:表示指定一个值的增加幅度。例如 n/m表示从 n 开始,每次增加 m 的时间点执行
*
* 一、配置文件用法
* cp = new Cron4jPlugin("cron4j.txt");
* me.add(cp);
*
* 配置文件:
* cron4j=task1, task2
* task1.cron=* * * * *
* task1.class=com.xxx.TaskAaa
* task1.daemon=true
* task1.enable=true
*
* task2.cron=* * * * *
* task2.class=com.xxx.TaskBbb
* task2.daemon=true
JFinal的任务调度cron4jPlugin源码
最新推荐文章于 2022-08-27 11:27:31 发布