Creates a new actor, that is a fork in the current concurrency scope, which protects a mutable resource (logic
) and executes invocations on it serially, one after another. It is guaranteed that logic
will be accessed by at most one thread at a time. The methods of logic: T
define the actor's interface (the messages that can be "sent to the actor").
Invocations can be scheduled using the returned ActorRef
. When an invocation is an ActorRef.ask, any non-fatal exceptions are propagated to the caller, and the actor continues. Fatal exceptions, or exceptions that occur during ActorRef.tell invocations, cause the actor's channel to be closed with an error, and are propagated to the enclosing scope.
The actor's mailbox (incoming channel) will have a capacity as specified by the BufferCapacity in scope.