Scheduled Executor in Scala -


in java can use scheduled executor schedule tasks run after given delay. can use in scala wonder if there scala api that.

is there scala api (as opposed scheduled executor in java) schedule tasks?

akka has similar schedulers:

http://doc.akka.io/api/akka/2.1.4/#akka.actor.scheduler

you can obtain 1 actor system:

val actorsystem = actorsystem() val scheduler = actorsystem.scheduler val task = new runnable { def run() { log.info("hello") } } implicit val executor = actorsystem.dispatcher  scheduler.schedule(   initialdelay = duration(5, timeunit.seconds),   interval = duration(10, timeunit.seconds),   runnable = task) 

if using akka or based on it, play, way go.


Comments