您的位置:首页 > 编程语言 > Java开发

spring-task的属性理解

2017-11-16 17:29 316 查看
案例:

<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是串行的)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: