learning scala akka actorySystem create and close

时间:2023-03-09 08:09:35
learning scala akka actorySystem create and close
package com.example

import akka.actor.ActorSystem

import scala.util.{Failure, Success}
import scala.concurrent.ExecutionContext.Implicits.global
object Tutorial_01_ActorSystem_Introduction extends App {
println("Step1 : Create an actor system")
val system = ActorSystem("DonutStoreActorSystem") println("\nStep 2: close the actor system")
val isTerminated = system.terminate() println("\nStep3: Check the status of the actory system")
isTerminated.onComplete {
case Success(result) => println("Success terminate")
case Failure(e) => println("Failed to terminate");
} Thread.sleep() }

result:

Step1 : Create an actor system

Step : close the actor system

Step3: Check the status of the actory system
Success terminate