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
- Alphabetic
- By Inheritance
- CallingThreadDispatcher
- MessageDispatcher
- ExecutionContextExecutor
- ExecutionContext
- BatchingExecutor
- Executor
- AbstractMessageDispatcher
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new CallingThreadDispatcher(_configurator: MessageDispatcherConfigurator)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toany2stringadd[CallingThreadDispatcher] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (CallingThreadDispatcher, B)
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toArrowAssoc[CallingThreadDispatcher] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def attach(actor: ActorCell): Unit
- Definition Classes
- MessageDispatcher
- def batchable(runnable: Runnable): Boolean
- Definition Classes
- BatchingExecutor
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- val configurator: MessageDispatcherConfigurator
- Definition Classes
- MessageDispatcher
- def createMailbox(actor: Cell, mailboxType: MailboxType): CallingThreadMailbox
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- final def detach(actor: ActorCell): Unit
- Definition Classes
- MessageDispatcher
- def dispatch(receiver: ActorCell, handle: Envelope): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def ensuring(cond: (CallingThreadDispatcher) => Boolean, msg: => Any): CallingThreadDispatcher
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toEnsuring[CallingThreadDispatcher] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (CallingThreadDispatcher) => Boolean): CallingThreadDispatcher
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toEnsuring[CallingThreadDispatcher] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): CallingThreadDispatcher
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toEnsuring[CallingThreadDispatcher] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): CallingThreadDispatcher
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toEnsuring[CallingThreadDispatcher] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- val eventStream: EventStream
- Definition Classes
- MessageDispatcher
- def execute(runnable: Runnable): Unit
- Definition Classes
- BatchingExecutor → Executor
- def executeTask(invocation: TaskInvocation): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def id: String
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- final def inhabitants: Long
- Definition Classes
- MessageDispatcher
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final val isThroughputDeadlineTimeDefined: Boolean
- Attributes
- protected[pekko]
- Definition Classes
- MessageDispatcher
- val log: LoggingAdapter
- val mailboxes: Mailboxes
- Definition Classes
- MessageDispatcher
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def register(actor: ActorCell): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def registerForExecution(mbox: Mailbox, hasMessageHint: Boolean, hasSystemMessageHint: Boolean): Boolean
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def reportFailure(t: Throwable): Unit
- Definition Classes
- MessageDispatcher → ExecutionContext
- final def resubmitOnBlock: Boolean
- Attributes
- protected
- Definition Classes
- MessageDispatcher → BatchingExecutor
- def resume(actor: ActorCell): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def shutdown(): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def shutdownTimeout: FiniteDuration
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def suspend(actor: ActorCell): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def systemDispatch(receiver: ActorCell, message: SystemMessage): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def throughput: Int
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def throughputDeadlineTime: FiniteDuration
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def unbatchedExecute(r: Runnable): Unit
- Attributes
- protected
- Definition Classes
- MessageDispatcher → BatchingExecutor
- def unregister(actor: ActorCell): Unit
- Attributes
- protected[pekko]
- Definition Classes
- CallingThreadDispatcher → MessageDispatcher
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toStringFormat[CallingThreadDispatcher] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)instead ofvalue.formatted(formatString), or use thef""string interpolator. In Java 15 and later,formattedresolves to the new method in String which has reversed parameters.
- def prepare(): ExecutionContext
- Definition Classes
- ExecutionContext
- Annotations
- @deprecated
- Deprecated
(Since version 2.12.0) preparation of ExecutionContexts will be removed
- def →[B](y: B): (CallingThreadDispatcher, B)
- Implicit
- This member is added by an implicit conversion from CallingThreadDispatcher toArrowAssoc[CallingThreadDispatcher] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.