0

Now I have to run the schedule every day and check if the day is Monday. But it is hard to control the exact time(e.g. I want to run it on 1 o'clock) So are there any ways to implement my schedule directly?

Akka.system().scheduler().schedule(
  Duration.create(5, TimeUnit.MINUTES),
  Duration.create(1, TimeUnit.DAYS),
  instance, "check", 
  Akka.system().dispatcher()
);
Mark_H
  • 770
  • 1
  • 6
  • 19

1 Answers1

1

Take a look a the same problem here: https://stackoverflow.com/a/14706767/1066240

You need to modify it a little to find 1 o'clock of next monday and then schedule the task to repeat weekly instead of daily.

Community
  • 1
  • 1
biesior
  • 55,576
  • 10
  • 125
  • 182
  • 1
    A way to schedule taks in a simple way would make a great Play (or Akka) plugin. Also, it could make a nice custon Scala DSL, e.g. `schedule(next Monday at 13:00, every week, ...)`. – Carsten Aug 30 '13 at 07:48