Skip to content

Instantly share code, notes, and snippets.

@onilton
Created September 27, 2013 08:39
Show Gist options
  • Save onilton/6725726 to your computer and use it in GitHub Desktop.
Save onilton/6725726 to your computer and use it in GitHub Desktop.
Scheduled task in scala
import akka.actor.ActorSystem
import scala.concurrent.duration._
val actorSystem = ActorSystem()
val scheduler = actorSystem.scheduler
val task = new Runnable { def run() { println("Hello") } }
implicit val executor = actorSystem.dispatcher
scheduler.schedule(
initialDelay = 5 seconds,
interval = 3 seconds,
runnable = task)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment