博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
What is corresponding Cron expression to fire in every X seconds, where X > 60? --转载
阅读量:6593 次
发布时间:2019-06-24

本文共 1341 字,大约阅读时间需要 4 分钟。

原文地址: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上一看,明白自己掉坑里了。

转载地址:http://jqdio.baihongyu.com/

你可能感兴趣的文章
samba介绍和安装
查看>>
利用JavaScript jQuery实现图片无限循环轮播(不借助于轮播插件)-----转载
查看>>
函数的原型对象和原型链?
查看>>
js中的面向对象
查看>>
050:navie时间和aware时间详解
查看>>
如何正确地在Spring Data JPA和Jackson中用上Java 8的时间相关API(即JSR 310也即java.time包下的众神器)...
查看>>
【python】-- 函数、无参/有参参数、全局变量/局部变量
查看>>
KMP算法(AC自动机前奏)(转)
查看>>
基于WinSvr2016(TP)构建的“超融合技术架构”进阶篇
查看>>
2013喜获MVP殊荣,这个国庆不一样
查看>>
CocoStudio 1.4.0.1数据编辑器使用
查看>>
关于使用Android NDK编译ffmpeg
查看>>
跟我一起考PMP--项目人力资源管理
查看>>
【虚拟化实战】存储设计之七Block Size
查看>>
烂泥:记一次诡异的网络中断
查看>>
在 SELECT 查询中使用集运算符
查看>>
UITableView 延迟加载图片的例子
查看>>
控制IMG图片的大小缩放
查看>>
Visual C++ 时尚编程百例006(快捷键)
查看>>
ASP.NET MVC3 系列教程 - 如何使项目Debug进MVC3源代码
查看>>