在 Grails 中禁用 Quartz 作业
我在 Grails 中使用 Quartz 插件。是否有一种配置可以用来禁用该作业,而无需注释或删除整个文件?
I am using the Quartz plugin in Grails. Is there a configuration that I can use to disable the job, without commenting out or deleting the whole file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作为解决方法,您可以让作业检查配置选项,或查询数据库,并且如果不应该这样做,则不执行其操作。
as a workaround, you could make the job check a configuration option, or query the DB, and just not do its thing if its not supposed to.
我相当确定当前版本的 Quartz 中不存在此功能。然而,有一个补丁可以实现作业取消和重新安排,因此它似乎有可能在(不久?)的将来添加到正式版本中。有关详细信息,请参阅此电子邮件线程。如果您想亲自尝试该补丁,可以在错误跟踪器上找到它。
I'm fairly certain this functionality does not exist in the current version of Quartz. However there is a patch that implements job cancellation and rescheduling, so it seems plausible that it will be added to the official release in the (near?) future. See this email thread for details. If you want to try the patch yourself, it can be found on the bug tracker.
我不知道这是否仍然相关,但是添加一个 return 语句作为execute() 方法中的第一行怎么样?
I don't know if this is still relevant, but how about adding a return statement as the first line in the execute() method?