开发者

How to make a specific scheduling job running from the time it is started?

开发者 https://www.devze.com 2023-03-05 05:26 出处:网络
I need to schedule a task that will perform the task at the given time by user.But this scheduling I need to run whether the application is running or not.So how could I specify the scheduling using q

I need to schedule a task that will perform the task at the given time by user. But this scheduling I need to run whether the application is running or not. So how could I specify the scheduling using quartz?

I am writing the code for the situation in servlet and then from where I need to run that servlet I am bit confused about it, because if I would use the load-on-startup it will ca开发者_如何学JAVAll servlet every time the application is loaded so it will cause the job detail to be duplicated in data tables. And the scheduling will stop when user will logout the session. But I want the scheduling to be running till the tomcat is running.

Any help is appreciated. Thanks in advance.


To avoid duplication of the job in the database you can write your code to first check for the job before scheduling, or to first delete the job (whether or not it exists) before scheduling.

In 2.x API there is a checkExists() set of methods.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号