Spring内置的Scheduler是否持久化? [英] Is Spring's built in Scheduler persistent.?

查看:215
本文介绍了Spring内置的Scheduler是否持久化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了必须使用持久调度程序的情况,因为我有一个Web应用程序,由于某些问题该应用程序可能会崩溃或关闭,如果发生这种情况,它可能会丢失其工作详细信息.我尝试了以下方法:

I have run into a case where I have to use a persistent Scheduler, since I have a web application that can crash or close due to some problems and might lose it job details if this happens . I have tried the following:

  • 使用Quartz调度程序:

我首先使用了RAMJobStore,但是由于它不是持久性的,因此没有太大帮助.无法设置JDBCJobStore,因为这将需要对现有代码库进行大量代码更改. 鉴于这种情况, 我有以下查询:

I used RAMJobStore first, but since it isn't persistent, it wasn't of much help. Can't setup JDBCJobStore because, this will require huge code changes to my existing code base. In light of such a scenario, I have the following queries:

  • 如果我使用Spring内置的@Schedule批注 ..我不在乎应用程序启动后是否安排了工作.我只想要这些工作不丢失其详细信息和触发器.?
  • 如果不是,是否还有其他可遵循的其他选择,请记住我需要使用调度程序来调度多个作业.?
  • 如果我该如何实现.?每个工作的触发因素都不同.例如,我可能有一份工作定于上午9点,另一份定于上午8.30,依此类推.
  • 如果不是调度程序,那么我可以使用一种机制来处理此问题吗?
  • If I use Spring's built in @Schedule annotation will my jobs be persistent..? I don't mind if the jobs get scheduled after the application starts. All I want is the jobs to not lose their details and triggers.?
  • If not, are there any other alternatives that can be followed , keeping in mind that I need to schedule multiple jobs with my scheduler.?
  • If yes, how can I achieve this.? My triggers are different each job. For e.g I might have a job that is scheduled at 9AM and another at 8.30AM and so on.
  • If not a scheduler, then can I have a mechanism to handle this.?

我发现一件事是Quartz的文档描述性很差.我的意思是顶级配置很好,但是在您的应用程序上配置它很痛苦.这只是一个旁注.与这个问题无关.

One thing, I found is that the documentation for Quartz isn't very descriptive. I mean it's fine for a top level config, but configuring it on your an application is a pain. This is just a side note. Nothing to do with the question.

感谢帮助. :)

推荐答案

@Schedule与实际的执行程序无关.默认的Java执行程序不是持久性的(也许有一些特定于应用程序服务器的),如果要持久性,则必须使用

@Schedule has nothing to do with the actual executor. The default java executors aren't persistent (maybe there are some app-server specific ones that are), if you want persistence you have to use Quartz for job execution.

这篇关于Spring内置的Scheduler是否持久化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆