首页 > 其他 > 详细

learning scala akka actorySystem create and close

时间:2019-08-23 16:32:20      阅读:73      评论:0      收藏:0      [点我收藏+]
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(5000)

}

result:

Step1 : Create an actor system

Step 2: close the actor system

Step3: Check the status of the actory system
Success terminate

 

learning scala akka actorySystem create and close

原文:https://www.cnblogs.com/lianghong881018/p/11400696.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!