石英 Fire Job 立即不起作用 [英] quartz Fire Job immediately doesn't work

查看:63
本文介绍了石英 Fire Job 立即不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将quartz 2 和spring 4 与maven 和java 注释(使用servlet 3)集成在一起,我也在使用tomcat 7 maven 插件来部署我的项目,我的quartz 配置类如下:

I integrated quartz 2 and spring 4 with maven and java annotation ( using servlet 3 ), also i am using tomcat 7 maven plugin for deploying my project,my quartz Configuration class like as below :

和我的工作类定义如下:

and my job class define simply like as below :

然后我使用石英调度程序立即使用我的工作触发器,如下所示:

then i use the quartz Scheduler for using fire my job trigger immediately as below :

但我的问题是:当我使用 "job1" 和 "mygroup" 参数调用 fireNow 方法时,什么也没有发生,我的 job1 不会立即调用,也不会在控制台中打印任何内容,我还跟踪了我注意到的数据库表运行 fireNow 方法后,在 mysql 的 qrtz_triggers 表中插入新行:

but my problem is : when i call fireNow methode with "job1" , "mygroup" parameters nothing happens and my job1 do not call immediately and don't print anything in console, i also track the db tables an i noticed after running the fireNow method new row inserted in my qrtz_triggers table in mysql:

推荐答案

如果 Quartz 调度器没有设置为自动启动.您需要明确启动它.

If Quartz scheduler is not set to start automatically. You need to start it explicitly.

scheduler.start();

如果 Quartz 调度器成功启动,您应该在日志或控制台输出中看到类似如下的信息.

If Quartz scheduler started successful, you should see information in your log or console output similar as below.

[main] INFO org.quartz.core.QuartzScheduler - 调度器元数据:Quartz Scheduler (v2.2.1)
'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' with instanceId 'MyScheduler'
调度程序类:'org.quartz.core.QuartzScheduler' - 在本地运行.
未开始.
当前处于待机模式.
执行的作业数:0

使用线程池'org.quartz.simpl.SimpleThreadPool' - 有 10 个线程.
使用不支持持久性的作业存储org.quartz.simpl.RAMJobStore".并且不聚集.
...
[main] INFO org.quartz.core.QuartzScheduler - 开始

[main] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.1)
'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' with instanceId 'MyScheduler'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0

Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
...
[main] INFO org.quartz.core.QuartzScheduler - started

这篇关于石英 Fire Job 立即不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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