class CallingThreadDispatcher extends MessageDispatcher

Dispatcher which runs invocations on the current thread only. This dispatcher does not create any new threads, but it can be used from different threads concurrently for the same actor. The dispatch strategy is to run on the current thread unless the target actor is either suspendSwitch or already running on the current thread (if it is running on a different thread, then this thread will block until that other invocation is finished); if the invocation is not run, it is queued in a thread-local queue to be executed once the active invocation further up the call stack finishes. This leads to completely deterministic execution order if only one thread is used.

Suspending and resuming are global actions for one actor, meaning they can affect different threads, which leads to complications. If messages are queued (thread-locally) during the suspendSwitch period, the only thread to run them upon resume is the thread actually calling the resume method. Hence, all thread-local queues which are not currently being drained (possible, since suspend-queue-resume might happen entirely during an invocation on a different thread) are scooped up into the current thread-local queue which is then executed. It is possible to suspend an actor from within its call stack.

Source
CallingThreadDispatcher.scala
Since

1.1

Linear Supertypes
MessageDispatcher, ExecutionContextExecutor, ExecutionContext, BatchingExecutor, Executor, AbstractMessageDispatcher, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CallingThreadDispatcher
  2. MessageDispatcher
  3. ExecutionContextExecutor
  4. ExecutionContext
  5. BatchingExecutor
  6. Executor
  7. AbstractMessageDispatcher
  8. AnyRef
  9. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CallingThreadDispatcher(_configurator: MessageDispatcherConfigurator)

Value Members

  1. final def attach(actor: ActorCell): Unit

    Attaches the specified actor instance to this dispatcher, which includes scheduling it to run for the first time (Create() is expected to have been enqueued by the ActorCell upon mailbox creation).

    Attaches the specified actor instance to this dispatcher, which includes scheduling it to run for the first time (Create() is expected to have been enqueued by the ActorCell upon mailbox creation).

    Definition Classes
    MessageDispatcher
  2. def batchable(runnable: Runnable): Boolean

    Override this to define which runnables will be batched.

    Override this to define which runnables will be batched.

    Definition Classes
    BatchingExecutor
  3. val configurator: MessageDispatcherConfigurator
    Definition Classes
    MessageDispatcher
  4. final def detach(actor: ActorCell): Unit

    Detaches the specified actor instance from this dispatcher

    Detaches the specified actor instance from this dispatcher

    Definition Classes
    MessageDispatcher
  5. val eventStream: EventStream
    Definition Classes
    MessageDispatcher
  6. def execute(runnable: Runnable): Unit
    Definition Classes
    BatchingExecutor → Executor
  7. def id: String

    Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.

    Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.

    Definition Classes
    CallingThreadDispatcherMessageDispatcher
  8. final def inhabitants: Long
    Definition Classes
    MessageDispatcher
  9. val log: LoggingAdapter
  10. val mailboxes: Mailboxes
    Definition Classes
    MessageDispatcher
  11. def reportFailure(t: Throwable): Unit
    Definition Classes
    MessageDispatcher → ExecutionContext

Deprecated Value Members

  1. def prepare(): ExecutionContext
    Definition Classes
    ExecutionContext
    Annotations
    @deprecated
    Deprecated

    (Since version 2.12.0) preparation of ExecutionContexts will be removed