动态时间安排建议
我正在使用 Jboss5.1.x、EJB3.0、Quartz 1.8
我有在特定时间(大约该时间)激活的系统。 该系统应该每天工作一次。
我在数据库中设置值,其中提到了激活时间,并且系统每小时都会提取该值以检查当前时间是否与该值匹配(如果是,系统将自行激活)。 这个时间在未来必须是动态变化的。
现在这个技术让我很头疼,因为我需要做一些数学计算(如果当前时间已经过去了几分钟,我仍然需要激活系统。 更重要的是,我需要处理系统已经激活的情况,因此它不会在同一天再次激活(由于时间错误计算)。
我可以考虑其他技术,每隔几天提取一次数据库来检查如果激活时间发生了变化(在这种情况下,我不需要每小时拉一次,但在其他情况下,我不确定 Quartz 可以在运行时重新安排它的触发器)
有什么想法吗?解决方案?
谢谢, 射线。
I am using Jboss5.1.x, EJB3.0, Quartz 1.8
I have System which is being activated at specific time(surrounding that time).
The system should work once in a day.
I am setting value in a database which mention the activation time and every hour the system is pulling that value to check if the current time is matching the value (in case it is the system will activate itself).
This time has to be changeable in the future dynamiclly.
Now this technic gives me a headache, since I need to do some Math calculations (in case the current time has passed in couple of mins I still need to activate the system.
more over I need to take care for a case the system already activated so it wont be activated again in the same day (due to a time mistake caluclations.)
I could think about other technic which pulling the database once in couple of days to check if the activiation time has ever change(in this case I wont need to pull every hour, but in other case i am not sure Quartz can re-schedualre it's triggers while it's running)
any ideas? solutions?
Thanks,
ray.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您绝对可以在 Quartz 运行时重新安排触发器(或添加新触发器)。
如果您愿意,您甚至可以在执行作业中执行此操作。
You absolutely can reschedule triggers while Quartz is running (or add new triggers).
You can even do that from within the executing jobs if you like.
这是我的解决方案的一个很好的例子:
动态时间安排建议
This a great example for my solution:
Dynamic time scheduling advice