无法使用grails 使用quartz 插件运行多个作业
你好,我正在使用grails 的quartz 插件。 当我只有一份工作时(我使用“create-job”命令),一切都按预期进行! 这就是作业的样子,它将每 1 秒打印一次:
class MyFirstJob{
def concurrent = false
static triggers = {
simple name: 'myFirstJobTrigger', startDelay: 1000, repeatInterval: 1000 }
def group = "MyGroup"
def execute(){
println "MyFirstJob run!"
}
}
现在,如果我添加另一个作业,该作业应该每 5 秒打印一次,如下所示:
class MySecondJob{
def concurrent = false
static triggers = {
simple name: 'mySecondJobTrigger', startDelay: 1000, repeatInterval: 5000 }
def group = "MyGroup"
def execute(){
println "MySecondJob run!"
}
}
现在会发生的是 job1 将仅每 5 秒开始工作 看来石英堵漏只能有1个作业计划 我想知道我错过了什么或做错了什么
我什至尝试了conf目录下一个名为quartz.properties的文件中的接下来两行:
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
感谢您的帮助
hi there I'm using quartz plugin for grails.
when i have just 1 job (i used "create-job" command) everything works as expected!
this is how the job looks like and it will print every 1 second:
class MyFirstJob{
def concurrent = false
static triggers = {
simple name: 'myFirstJobTrigger', startDelay: 1000, repeatInterval: 1000 }
def group = "MyGroup"
def execute(){
println "MyFirstJob run!"
}
}
now if i add another job that should print every 5 sec that look like this:
class MySecondJob{
def concurrent = false
static triggers = {
simple name: 'mySecondJobTrigger', startDelay: 1000, repeatInterval: 5000 }
def group = "MyGroup"
def execute(){
println "MySecondJob run!"
}
}
what will happen now is that job1 will start working only every 5 seconds
it seems that quartz pluging can only have 1 job schedule
i was wondering what am i missing or doing wrong
i even tried the next 2 lines in a file called quartz.properties under conf directory:
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该插件要求作业类文件名以“Job”结尾。因此,请确保 MyJob2 位于作业文件夹中名为“My2Job.groovy”的文件中
The plugin requires the job class filename to end in 'Job'. Therefore, make sure that MyJob2 is in a file named 'My2Job.groovy' in the job folder