如何设置石英触发器的优先级? [英] How can I set priorities to quartz trigger?

查看:38
本文介绍了如何设置石英触发器的优先级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Quartz Scheduler,有 15 个作业.对于每项工作,都有一个触发器.我想为每个触发器设置优先级.我可以将低优先级设置为 10,将高优先级设置为 1.但是因为我有 15 个触发器用于 15 个作业,所以每个触发器需要不同的优先级.例如,trigger1 的优先级为 10,trigger2 的优先级为 9.这样,我需要为两个触发器赋予相同的优先级.

I am using Quartz Scheduler and there are 15 jobs. For each job there is one trigger. I want to set priority for each trigger. I can set low priority as 10 and high priority as 1. But as I am having 15 triggers for 15 jobs I need different priority for each trigger. e.g trigger1 will have priority 10, trigger2 will have priority 9. In this way I need to give same priority for two triggers.

那么如果两个具有相同优先级的触发器同时执行,那么哪个触发器会先执行?

So if two triggers with same priority will get execute at same time then which trigger will execute first?

谁能告诉我如何为不同的触发器设置不同的优先级?

Can anyone tell me how I can set different priorities for different triggers?

推荐答案

触发器有一个 'priority' 属性.只需在创建触发器时相应地设置属性,或使用 api 检索触发器、设置优先级并重新安排它们.

Triggers have a 'priority' property on them. Just set the property accordingly as the triggers are created, or use the api to retrieve the triggers, set the priorities, and reschedule them.

如果两个或多个触发器具有相同的触发时间和相同的优先级,则将随机选择一个首先触发(排序还可以基于什么?).

If two or more triggers have the same fire time and same priority, one will be randomly chosen for firing first (what else could the ordering be based on?).

这篇关于如何设置石英触发器的优先级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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