如何在上午8点至上午10点之间每15分钟配置SinglethreadScheduledexecutor,然后全天每1hr跑15分钟
我需要一些帮助,以实施如何实施SinglethreadScheduledexecutor,以在英国时间上午8点至上午10点之间每15分钟,然后全天每1hr跑。
目前,我有以下Scala代码 -
val pollingExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MyTestScheduledThread"))
pollingExecutor.scheduleWithFixedDelay(new MyRunnableJob(), 0, 15, TimeUnit.MINUTES)
I need some assistance on how to implement the SingleThreadScheduledExecutor to run the job every 15mins between 8 am to 10 am UK time and then every 1hr throughout the day.
Currently, I have the following Scala code -
val pollingExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MyTestScheduledThread"))
pollingExecutor.scheduleWithFixedDelay(new MyRunnableJob(), 0, 15, TimeUnit.MINUTES)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会在工作的工作周围制作一个包装器:
然后您可以做:
I would make a wrapper around the job that takes care of scheduling:
And then you can just do: