spring 定时器时间配置
Spring--quartz中cronExpression
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute". “*”字符被用来指定所有的值。如:”*“在分钟的字段域里表示“每分钟”。 The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fileds, but not the other. See the examples below for clarification. “?”字符只在日期域和星期域中使用。它被用来指定“非明确的值”。当你需要通过在这两个域中的一个来指定一些东西的时候,它是有用的。看下面的例子你就会明白。 月份中的日期和星期中的日期这两个元素时互斥的一起应该通过设置一个问号(?)来表明不想设置那个字段
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12". “-”字符被用来指定一个范围。如:“10-12”在小时域意味着“10点、11点、12点”。
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday". “,”字符被用来指定另外的值。如:“MON,WED,FRI”在星期域里表示”星期一、星期三、星期五”.
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with. Essentially, for each field in the expression, there is a set of numbers that can be turned on or off. For seconds and minutes, the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to 31, and for months 1 to 12. The "/" character simply helps you turn on every "nth" value in the given set. Thus "7/6" in the month field only turns on month "7", it does NOT mean every 6th month, please note that subtlety.
The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last friday of the month". When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get confusing results.
L是‘last’的省略写法可以表示day-of-month和day-of-week域,但在两个字段中的意思不同,例如day-of-month域中表示一个月的最后一天, 如果在day-of-week域表示‘7’或者‘SAT’,如果在day-of-week域中前面加上数字,它表示一个月的最后几天,例如‘6L’就表示一个月的最后一个 星期五,
The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days . The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month".
The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month. For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month.
The 'C' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "calendar". This means values are calculated against the associated calendar, if any. If no calendar is associated, then it is equivalent to having an all-inclusive calendar. A value of "5C" in the day-of-month field means "the first day included by the calendar on or after the 5th". A value of "1C" in the day-of-week field means "the first day included by the calendar on or after sunday". 关于cronExpression的介绍:
quartz的高级特性不仅如此
1 数据库存储
2 集群支持
3 数据库持久化任务,trigger
4 trigger 的停止,运行
5 任务的任意添加
6 比corntrigger 更详尽的任务安排
7 线程的内部数据交换
spring 定时器时间配置的更多相关文章
- [spring-framework]Spring定时器的配置和使用
开发中我们常常会做一些定时任务,这些任务有开始时间,并会按一定的周期或规则执行.如此我们在Java程序开发中使用定时器来处理定时任务. <!-- MessageRequestTask类中包含了m ...
- spring定时器的配置
首先,新建一个java项目,下面导入需要的jar包: 这里有你需要的jar包哦. jar包下载 在src文件夹下,新建一个applicationContext.xml文件 <?xml versi ...
- Spring定时器——时间设置规则
平时经常有一些写Spring定时器的需求,但是每次要设置定时器的时间的时候,老是既不住,到处找别人的博客又各种不爽,所以就自己记录一份吧,顺便整理一下. org.springframework.sch ...
- Spring定时器注解配置
spring-task.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&qu ...
- Spring定时器XML配置
spring-task.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&qu ...
- spring定时器时间设置规则
单纯针对时间的设置规则org.springframework.scheduling.quartz.CronTriggerBean允许你更精确地控制任务的运行时间,只需要设置其cronExpressio ...
- spring定时器设置(转自:http://my.oschina.net/LvSantorini/blog/520049)
转自:http://my.oschina.net/LvSantorini/blog/520049<!-- MessageRequestTask类中包含了msgRequest方法,用于执行定时任务 ...
- 注解式开发spring定时器
1:spring 配置文件中增加这句 <task:annotation-driven/> 2:确保扫描程序能够扫描后 下面第3步骤的java类 <context:co ...
- 两种流行Spring定时器配置:Java的Timer类和OpenSymphony的Quartz
1.Java Timer定时 首先继承java.util.TimerTask类实现run方法 import java.util.TimerTask; public class EmailReportT ...
随机推荐
- 对redis的一些理解
缓存就是在内存中存储的数据备份,当数据没有发生本质变化的时候,我们避免数据的查询操作直接连接数据库,而是去 内容中读取数据,这样就大大降低了数据库的读写次数,而且从内存中读数据的速度要比从数据库 ...
- python UI自动化之JS定位
1.话不多说,直接贴入代码 上面的 document.getElementById 可以替换成别的定位方式,比如: 通过name获取:document.getElementsByName 通过标签获取 ...
- ASP.NET MVC 发布WIN SERVER2012
首先在打开服务器管理,点添加角色和功能 这个名字自己设置不打紧 勾选web服务器,之后点下一步 在功能选择中勾选下面部分 之后点击工具选择服务,确保web服务正在运行 此时服务端告一段落,返回主机打开 ...
- Centos 6.5 磁盘修复 破解删除root密码
起因:由于存储设备故障.导致虚拟机断开.恢复后虚拟机无法启动,发现报磁盘损坏,需要运行fsck运行 问题解决思路: 1.虚拟机无法启动,所以需要进入系统进行修复 2.root密码是自动修改的.由于虚拟 ...
- LeetCode.1051-身高检查器(Height Checker)
这是小川的第390次更新,第420篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第252题(顺位题号是1051).要求学生按身高递增的顺序站列来拍年度照片. 返回没有站在 ...
- 【VS开发】【智能语音处理】MATLAB 与 音频处理 相关内容摘记
MATLAB 与 音频处理 相关内容摘记 MATLAB 与 音频处理 相关内容摘记 1 MATLAB 音频相关函数 1 MATLAB 处理音频信号的流程 2 音量标准化 2 声道分离合并与组合 3 数 ...
- composer配合github发布管理代码包
前言 今日使用composer结合github管理代码包过程,方便日后需要,特此记录 流程 1 最大同性交友网站github创建自己项目,在自己项目新增composer.json文件 2 compos ...
- 模版include的用法
from flask import Flask,render_template app = Flask(__name__) @app.route('/') def hello_world(): ret ...
- [转帖]2018年全球ERP软件行业市场规模与发展趋势分析 云ERP将兴起【组图】
2018年全球ERP软件行业市场规模与发展趋势分析 云ERP将兴起[组图] https://www.qianzhan.com/analyst/detail/220/190215-4b1d6868.ht ...
- (5.1.4)引擎管理——SSMS管理使用小技巧
目录 [1]自带报表 [2]对象管理器详细信息 [3]日志 [4]活动监视器 [1]自带报表 无论是数据库.服务器实例.还是代理等等都可以有标准报表 [2]对象管理器详细信息 利用改方式,可以很有效的 ...