final
case class
Actor[A](handler: (A) ⇒ Unit, onError: (Throwable) ⇒ Unit = ActorUtils.rethrowError)(implicit strategy: Strategy) extends Product with Serializable
Instance Constructors
-
new
Actor(handler: (A) ⇒ Unit, onError: (Throwable) ⇒ Unit = ActorUtils.rethrowError)(implicit strategy: Strategy)
Value Members
-
def
!(a: A): Unit
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
def
apply(a: A): Unit
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
contramap[B](f: (B) ⇒ A): Actor[B]
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
val
handler: (A) ⇒ Unit
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
val
onError: (Throwable) ⇒ Unit
-
implicit
val
strategy: Strategy
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
val
toEffect: Run[A]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Processes messages of type
A
, one at a time. Messages are submitted to the actor with the method!
. Processing is typically performed asynchronously, this is controlled by the providedstrategy
.Memory consistency guarantee: when each message is processed by the
handler
, any memory that it mutates is guaranteed to be visible by thehandler
when it processes the next message, even if thestrategy
runs the invocations ofhandler
on separate threads. This is achieved because theActor
reads a volatile memory location before entering its event loop, and writes to the same location before suspending.Implementation based on non-intrusive MPSC node-based queue, described by Dmitriy Vyukov: http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue
The type of messages accepted by this actor.
The message handler
Exception handler, called if the message handler throws any
Throwable
.Execution strategy, for example, a strategy that is backed by an
ExecutorService