CallingThreadDispatcher

org.apache.pekko.testkit.CallingThreadDispatcher
See theCallingThreadDispatcher companion object

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.

Attributes

Since

1.1

Companion
object
Source
CallingThreadDispatcher.scala
Graph
Supertypes
trait Executor
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override 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.

Attributes

Definition Classes
Source
CallingThreadDispatcher.scala

Inherited methods

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).

Attributes

Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala
def batchable(runnable: Runnable): Boolean

Override this to define which runnables will be batched.

Override this to define which runnables will be batched.

Attributes

Inherited from:
BatchingExecutor (hidden)
Source
BatchingExecutor.scala
final def detach(actor: ActorCell): Unit

Detaches the specified actor instance from this dispatcher

Detaches the specified actor instance from this dispatcher

Attributes

Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala
override def execute(runnable: Runnable): Unit

Attributes

Definition Classes
BatchingExecutor -> Executor
Inherited from:
BatchingExecutor (hidden)
Source
BatchingExecutor.scala
final def inhabitants: Long

Attributes

Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala
override def reportFailure(t: Throwable): Unit

Attributes

Definition Classes
Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala

Deprecated and Inherited methods

Attributes

Deprecated
[Since version 2.12.0] preparation of ExecutionContexts will be removed
Inherited from:
ExecutionContext

Concrete fields

Inherited fields

Attributes

Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala
val mailboxes: Mailboxes

Attributes

Inherited from:
MessageDispatcher
Source
AbstractDispatcher.scala