开发者

Is it possible to schedule Quartz threads to run each second?

开发者 https://www.devze.com 2023-02-05 07:34 出处:网络
Is it 开发者_运维知识库possible to have Java Quartz threads run each second, or even by milliseconds? It seems like they can only run by the minute and nothing less.Yes, you can make them run every se

Is it 开发者_运维知识库possible to have Java Quartz threads run each second, or even by milliseconds? It seems like they can only run by the minute and nothing less.


Yes, you can make them run every second.

Take a look at TriggerUtils.makeSecondlyTrigger:

Make a trigger that will fire every second, indefinitely.

Or use a CronTrigger:

new CronTrigger("cronTrigger","group","* * * * * ?"); //fire at every second daily


Yes.

You need to go for Simple Trigger

trigger that fires immediately, then repeats every X mills, forever

SimpleTrigger trigger = new SimpleTrigger("myTrigger",
                                            null,
                                            new Date(),
                                            null,
                                            SimpleTrigger.REPEAT_INDEFINITELY,
                                            X);

Note: Where X is long type,
for example : if X=1000L then per second

0

精彩评论

暂无评论...
验证码 换一张
取 消