Quartz Scheduler:如何仅在一台机器上运行作业? [英] Quartz Scheduler: how to run a job in only one machine?

查看:57
本文介绍了Quartz Scheduler:如何仅在一台机器上运行作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将石英设置为在 2 台机器上执行(共享相同的数据库).如何设置quartz只在一台机器上运行一个作业(或一组作业)(另一台机器不能选择作业)?

I'm trying to setup quartz to execute in 2 machines (sharing the same database). How to setup quartz to run a job (or a set of jobs) in just one machine (another machine cannot pick the job)?

推荐答案

你能否详细说明一下你的问题.

Can you elaborate your question a bit.

1) 如果您希望两台机器共享负载但希望在任何给定时间只运行批处理的一个实例,那么您可以使用 @DisallowConcurrentExecution

1) If you want both the machines to share the load but want only one instance of the batch to be run at any given time, then you can annotate your job with @DisallowConcurrentExecution

2) 或者如果您总是希望只有一台机器来处理所有负载,那么您为什么要使用集群模式?如果您想实现主动-备用模型,那么您希望机器在石英之外进行协调,这可能会变得棘手.

2) or if you always want only one machine to handle all the load, then why are you using clustered mode? If you are trying to achieve active-stand by model, then you want the machines to co-ordinate outside of quartz which could get tricky.

这篇关于Quartz Scheduler:如何仅在一台机器上运行作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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