In play\'s 2.0.x doc you can see how to schedule asynchronous tasks:
http://www.playframework.org/documentation/2.0.4/ScalaAkka
Akka.system.scheduler
For example run a task every Saturday at 15 AM in java:
DateTime now = new DateTime();
DateTime plannedStart = new DateTime()
.withDayOfWeek(DateTimeConstants.SATURDAY)
.withHourOfDay(15)
.withMinuteOfHour(0)
.withSecondOfMinute(0)
.withMillisOfSecond(0);
DateTime nextRun = (now.isAfter(plannedStart))
? plannedStart.plusDays(7)
: plannedStart;
Long nextRunInSeconds = (long) secondsBetween(now, nextRun).getSeconds();
Akka.system().scheduler().schedule(
Duration.create(nextRunInSeconds, TimeUnit.SECONDS),
Duration.create(7, TimeUnit.DAYS) ,
new Runnable() {
public void run() {
Logger.info("-------------------------scheduler start : " + new DateTime());
}
},
Akka.system().dispatcher()
);