spring-task的属性理解

来源:互联网 发布:网络电影扫黄完整版 编辑:程序博客网 时间:2024/05/21 09:29

案例:

<task:scheduled-tasks><!-- <task:scheduled ref="timeJob" method="getWeChatOpenId" cron="0 0/1 * * * ?" /> --><!-- <task:scheduled ref="timeJob" method="getWeChatOpenId" cron="0 50 23 1/1 * ? " /> --><task:scheduled ref="xytimeJob" method="executeXYWithout" cron="0 0/1 * * * ?" /><!-- <task:scheduled ref="buJianTimeOut" method="rejectBuJianTimeOut" cron="0 0 0 * * ?" /> --><task:scheduled ref="buJianTimeOut" method="rejectBuJianTimeOut" cron="0 0/1 * * * ?" /><task:scheduled ref="timeJob" method="withholdSign" cron="0 0/1 * * * ? " /></task:scheduled-tasks>


名称解释:

ref注入类,注入定时任务的bean

method是工作类中要执行的方法

fixed-delay是上一个调用完成后再次调用的延时

fixed-rate是上一个调用开始后再次调用的延时(并行执行,不用等待上一次调用完成)

cron是表达式,表示在什么时候进行任务调度(使用cron表达式的时候task是串行的)。

原创粉丝点击