开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜