May 2017
Intermediate to advanced
414 pages
13h
English
import akka.actor.{Cancellable, Props, ActorSystem, Actor} import scala.concurrent.duration._
class CancelOperation extends Actor { var i = 10 def receive = { case "tick" => { println(s"Hi, Do you know i do the same task again and again") i = i - 1 if (i == 0) Scheduler.cancellable.cancel() } } }
object Scheduler extends App { val system = ActorSystem("Hello-Akka") import system.dispatcher val actor = system.actorOf(Props[CancelOperation]) val
Read now
Unlock full access