gpt4 book ai didi

java - Sling调度器方法重构

转载 作者:行者123 更新时间:2023-12-03 07:38:37 25 4
gpt4 key购买 nike

我已弃用方法 Scheduler.addPeriodicJob 。我想重构我的代码并将其替换为 Scheduler.schedule如何使用 ScheduleOptions 做到这一点接口(interface)以及如何通过它传递值?

最佳答案

看看this page 。看起来您需要将每个调用替换为:

Scheduler s;
s.addPeriodicJob(name, job, config, period, canRunConcurrently);

类似的东西

Scheduler s;
ScheduleOptions so = Scheduler.NOW(times, period); // times == -1 for endless
so.canRunConcurrently(canRunConcurrently);
so.config(config);
so.name(name);
s.schedule(job, so);

关于java - Sling调度器方法重构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32353815/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com