p>Simple and transparently distributable, high performance, lightweight and highly adaptable. Scalaz Actors Lift Actors Scala Actors Akka ActorsCurrent stable ver. 5 2.1 2.9.0 0.10Minimum Scala ver. 2.8 2.7.7 2.8Minimum Java ver. 1.5 1.5 1.6 演员模型支持Actor Model Support Scalaz Actors Lift Actors Scala Actors Akka ActorsSpawn new actors Yes Yes Yes Yesinside of actorSend messages to Yes Yes Yes Yesknown actorChange behavior Actors are Yes Yes: nested Yes:for next message immutable react/receive become/unbecomeSupervision Not provided No Actor: Yes, Yes(link/trapExit) Reactor: No 状态隔离级别 如果用户在其Actor的上定义了公共方法,Level of state isolationIf user defines public methods ontheir Actors, are they callable fromthe outside? Scalaz演员:n / a。演员是密封的特质。 举足轻重的演员:是 scala演员:是 阿卡演员:不,演员实例被屏蔽在ActorRef后面。Scalaz Actors: n/a. Actor is a sealed trait.Lift Actors: YesScala Actors: YesAkka Actors: No, actor instance is shielded behind an ActorRef. Scalaz演员:演员[A]扩展了A => () 升降演员:升降演员, SpecializeLiftActor [T] Scala Actor: Reactor [T] , Actor扩展Reactor [Any] Akka演员: Actor [Any]Scalaz Actors: Actor[A] extends A => ()Lift Actors: LiftActor, SpecializeLiftActor[T]Scala Actors: Reactor[T], Actor extends Reactor[Any]Akka Actors: Actor[Any] Scalaz Actors Lift Actors Scala Actors Akka ActorsManual start No No Yes YesManual stop No No No YesRestart-on-failure n/a Yes Yes Configurable per actor instanceRestart semantics n/a Rerun actor Restore actor to stable state by re-allocating it and behavior throw away the old instanceRestart configurability n/a n/a X times, X times within Y timeLifecycle hooks provided No lifecycle act preStart, postStop, preRestart, postRestart 消息发送模式Message send modes Scalaz Actors Lift Actors Scala Actors Akka ActorsFire-forget a ! message actor ! msg actor ! msg actorRef ! msg a(message)Send-receive-reply (see 1) actor !? msg actor !? msg actorRef !! msg actor !! msgSend-receive-future (see 2) actor !! msg actorRef !!! msgSend-result-of- promise(message). future.onComplete( f => to ! f.result )future to(actor)Compose actor with actor comap f No No Nofunction (see 3)(1)任何函数f都会成为这样的参与者:(1) Any function f becomes such an actor:val a: Msg => Promise[Rep] = f.promiseval reply: Rep = a(msg).get(2)任何函数f都会成为这样的参与者:(2) Any function f becomes such an actor:val a = f.promiseval replyFuture = a(message)(3)逆函子: actor comap f 。也是 Promise 中的Kleisli组成。(3) Contravariant functor: actor comap f. Also Kleisli composition in Promise. TBD Scalaz Actors Lift Actors Scala Actors Akka Actorsreply-to-sender-in-messagereply-to-message 消息处理 是否支持嵌套接收?Message processingSupports nested receives? Scalaz演员:- 升降演员:是(带有一点手工编码)。 Scala Actor:是的,基于线程的接收和基于事件的反应。 Akka Actors:否,嵌套接收会导致内存泄漏和降级性能。Scalaz Actors: --Lift Actors: Yes (with a little hand coding).Scala Actors: Yes, both thread-based receive and event-based react.Akka Actors: No, nesting receives can lead to memory leaks and degraded performance over time. TBD Scalaz Actors Lift Actors Scala Actors Akka ActorsName for Execution MechanismExecution Mechanism isconfigurableExecution Mechanism can bespecified on a per-actor basisLifecycle of Execution Mechanismmust be explicitly managedThread-per-actor executionmechanismEvent-driven execution mechanismMailbox typeSupports transient mailboxesSupports persistent mailboxes 分发/远程执行者Distribution/Remote Actors Scalaz Actors Lift Actors Scala Actors Akka ActorsTransparent remote n/a No Yes YesactorsTransport protocol n/a n/a Java Akka Remote Protocol serialization (Protobuf on top of TCP) on top of TCPDynamic clustering n/a n/a n/a In commercial offering 操作方法 TBDHowtosTBD Scalaz Actors Lift Actors Scala Actors Akka ActorsDefine an actorCreate an actor instanceStart an actor instanceStop an actor instance 这篇关于Scala中多个Actor的实现有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-05 11:20