Class MessageDispatcher

java.lang.Object
org.apache.pekko.dispatch.MessageDispatcher
All Implemented Interfaces:
Executor, BatchingExecutor, scala.concurrent.ExecutionContext, scala.concurrent.ExecutionContextExecutor
Direct Known Subclasses:
CallingThreadDispatcher, Dispatcher

public abstract class MessageDispatcher extends Object implements BatchingExecutor, scala.concurrent.ExecutionContextExecutor
  • Nested Class Summary

    Nested classes/interfaces inherited from interface scala.concurrent.ExecutionContext

    scala.concurrent.ExecutionContext.Implicits$, scala.concurrent.ExecutionContext.parasitic$
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    final void
    attach(org.apache.pekko.actor.ActorCell actor)
    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).
     
    protected abstract org.apache.pekko.dispatch.Mailbox
    createMailbox(Cell actor, MailboxType mailboxType)
    Creates and returns a mailbox for the given actor.
    static final boolean
     
    final void
    detach(org.apache.pekko.actor.ActorCell actor)
    Detaches the specified actor instance from this dispatcher
    protected abstract void
    dispatch(org.apache.pekko.actor.ActorCell receiver, Envelope invocation)
    Will be called when the dispatcher is to queue an invocation for execution
     
    protected abstract void
    INTERNAL API
    abstract String
    id()
    Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.
    final long
     
    protected final boolean
    INTERNAL API
    org.apache.pekko.dispatch.Mailboxes
     
    static void
     
    protected void
    register(org.apache.pekko.actor.ActorCell actor)
    If you override it, you must call it.
    protected abstract boolean
    registerForExecution(org.apache.pekko.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint)
    Suggest to register the provided mailbox for execution
    void
     
    static int
     
    protected final boolean
     
    protected void
    resume(org.apache.pekko.actor.ActorCell actor)
    After the call to this method, the dispatcher must begin any new message processing for the specified reference
    static int
     
    protected abstract void
    Called one time every time an actor is detached from this dispatcher and this dispatcher has no actors left attached Must be idempotent
    protected abstract scala.concurrent.duration.FiniteDuration
    When the dispatcher no longer has any actors registered, how long will it wait until it shuts itself down, defaulting to your pekko configs "pekko.actor.default-dispatcher.shutdown-timeout" or default specified in reference.conf
    protected void
    suspend(org.apache.pekko.actor.ActorCell actor)
    After the call to this method, the dispatcher mustn't begin any new message processing for the specified reference
    protected abstract void
    systemDispatch(org.apache.pekko.actor.ActorCell receiver, SystemMessage invocation)
    Will be called when the dispatcher is to queue an invocation for execution
    protected abstract int
    INTERNAL API
    protected abstract scala.concurrent.duration.Duration
    INTERNAL API
    protected final void
     
    protected void
    unregister(org.apache.pekko.actor.ActorCell actor)
    If you override it, you must call it.
    static int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.pekko.dispatch.BatchingExecutor

    batchable, execute

    Methods inherited from interface scala.concurrent.ExecutionContext

    execute, prepare
  • Constructor Details

  • Method Details

    • UNSCHEDULED

      public static int UNSCHEDULED()
    • SCHEDULED

      public static int SCHEDULED()
    • RESCHEDULED

      public static int RESCHEDULED()
    • debug

      public static final boolean debug()
    • actors

      public static Index<MessageDispatcher,ActorRef> actors()
    • printActors

      public static void printActors()
    • configurator

      public MessageDispatcherConfigurator configurator()
    • mailboxes

      public org.apache.pekko.dispatch.Mailboxes mailboxes()
    • eventStream

      public EventStream eventStream()
    • inhabitants

      public final long inhabitants()
    • createMailbox

      protected abstract org.apache.pekko.dispatch.Mailbox createMailbox(Cell actor, MailboxType mailboxType)
      Creates and returns a mailbox for the given actor.
    • id

      public abstract String id()
      Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.
    • attach

      public final void attach(org.apache.pekko.actor.ActorCell actor)
      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).
    • detach

      public final void detach(org.apache.pekko.actor.ActorCell actor)
      Detaches the specified actor instance from this dispatcher
    • resubmitOnBlock

      protected final boolean resubmitOnBlock()
      Specified by:
      resubmitOnBlock in interface BatchingExecutor
    • unbatchedExecute

      protected final void unbatchedExecute(Runnable r)
      Specified by:
      unbatchedExecute in interface BatchingExecutor
    • reportFailure

      public void reportFailure(Throwable t)
      Specified by:
      reportFailure in interface scala.concurrent.ExecutionContext
    • register

      protected void register(org.apache.pekko.actor.ActorCell actor)
      If you override it, you must call it. But only ever once. See "attach" for only invocation.

      INTERNAL API

    • unregister

      protected void unregister(org.apache.pekko.actor.ActorCell actor)
      If you override it, you must call it. But only ever once. See "detach" for the only invocation

      INTERNAL API

    • shutdownTimeout

      protected abstract scala.concurrent.duration.FiniteDuration shutdownTimeout()
      When the dispatcher no longer has any actors registered, how long will it wait until it shuts itself down, defaulting to your pekko configs "pekko.actor.default-dispatcher.shutdown-timeout" or default specified in reference.conf

      INTERNAL API

    • suspend

      protected void suspend(org.apache.pekko.actor.ActorCell actor)
      After the call to this method, the dispatcher mustn't begin any new message processing for the specified reference
    • resume

      protected void resume(org.apache.pekko.actor.ActorCell actor)
      After the call to this method, the dispatcher must begin any new message processing for the specified reference
    • systemDispatch

      protected abstract void systemDispatch(org.apache.pekko.actor.ActorCell receiver, SystemMessage invocation)
      Will be called when the dispatcher is to queue an invocation for execution

      INTERNAL API

    • dispatch

      protected abstract void dispatch(org.apache.pekko.actor.ActorCell receiver, Envelope invocation)
      Will be called when the dispatcher is to queue an invocation for execution

      INTERNAL API

    • registerForExecution

      protected abstract boolean registerForExecution(org.apache.pekko.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint)
      Suggest to register the provided mailbox for execution

      INTERNAL API

    • throughput

      protected abstract int throughput()
      INTERNAL API
    • throughputDeadlineTime

      protected abstract scala.concurrent.duration.Duration throughputDeadlineTime()
      INTERNAL API
    • isThroughputDeadlineTimeDefined

      protected final boolean isThroughputDeadlineTimeDefined()
      INTERNAL API
    • executeTask

      protected abstract void executeTask(TaskInvocation invocation)
      INTERNAL API
    • shutdown

      protected abstract void shutdown()
      Called one time every time an actor is detached from this dispatcher and this dispatcher has no actors left attached Must be idempotent

      INTERNAL API