原文地址:http://stackoverflow.com/questions/2996280/what-is-corresponding-cron-expression-to-fire-in-every-x-seconds-where-x-60

Question:

I want my jobs to execute in every X seconds, there's one to one matching between job and X. Also during runtime there can be registered new jobs with their own intervals.

I've tried to write cron expression for such scenarios, but in documentation there's written that value of seconds can't be more than 59. So cron expression like this: "0/63 * * * * ?" isn't valid.

At first sight solution of that problem seemed to be expression like this: "0/3 0/1 * * * ?", but it means completely different thing: trigger job in every three second of every minute.

Can you suggest what is the right solution (cron expression) for that? I know I could use just simple timers, but I've to use cron jobs using Quartz.

answer:

The Quartz cron syntax is designed to express timing based on the standard 24 hour, 60 minute clock. It's not suitable for "every n seconds", where n can be any value. You're not going to able to do this with cron expressions.

If you need to do this with Quartz, you should use SimpleTrigger, not CronTrigger. You don't really have an option, unless you want to use a hugely complex collection of overlapping, artificially-deduced cron expressions.

碰到这个问题的时候,我陷入了误区,在stackoverflow上一看,明白自己掉坑里了。

最新文章

  1. 关于w3school的html5部分output 元素实例代码(点亲自试一试进去)的问题纠正
  2. Oracle 物化视图创建
  3. Knockout.Js官网学习(style绑定、attr绑定)
  4. EXT--columnWidth
  5. js倒计时 重发 效果
  6. 基于visual Studio2013解决C语言竞赛题之0510求最大和
  7. 通过反射实现Json数据部分更新JavaBean的属性
  8. Caffe-5.2-(GPU完整流程)训练(依据googlenet微调)
  9. android studio——替换全局的某个字符串
  10. 用 Cobertura 测量测试覆盖率
  11. oracle查询出来的时间吸附为每5min
  12. android用TextView实现跑马灯效果
  13. uml的几种关系总结
  14. VueJs大全;vee-validate(一个验证vue插件), bootstrap-vue, axios简介。
  15. 04_JSX练习
  16. 数组中超过N分之一的数字
  17. JAVA框架 SpringMVC RequestMapping讲解
  18. C++ 默认构造函数小记
  19. Django 连接redis方法
  20. zabbix监控系统日志

热门文章

  1. selenium使用报错“selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.”
  2. idea中实现类快速重写service方法 快捷键
  3. Mysql学习总结(9)——MySql视图原理讲解与使用大全
  4. TCP的可靠性 窗口滑动 拥塞控制
  5. OR1200处理器中Wishbone总线接口模块WB_BIU介绍
  6. C - The C Answer (2nd Edition) - Exercise 1-4
  7. 数据库优化技巧之in和not in
  8. 48.Cookie 管理
  9. 26.使用IntelliJ IDEA开发Java Web项目时,修改了JSP后刷新浏览器无法及时显示修改后的页面
  10. Linux基础(vim)