Package org.apache.pekko.dispatch
Class Dispatcher
java.lang.Object
org.apache.pekko.dispatch.MessageDispatcher
org.apache.pekko.dispatch.Dispatcher
- All Implemented Interfaces:
Executor,BatchingExecutor,scala.concurrent.ExecutionContext,scala.concurrent.ExecutionContextExecutor
- Direct Known Subclasses:
PinnedDispatcher
The event-based
Dispatcher binds a set of Actors to a thread pool backed up by a
BlockingQueue.
The preferred way of creating dispatchers is to define configuration of it and use the
the lookup method in pekko.dispatch.Dispatchers.
param: throughput positive integer indicates the dispatcher will only process so much messages at a time from the mailbox, without checking the mailboxes of other actors. Zero or negative means the dispatcher always continues until the mailbox is empty. Larger values (or zero or negative) increase throughput, smaller values increase fairness
-
Nested Class Summary
Nested classes/interfaces inherited from interface scala.concurrent.ExecutionContext
scala.concurrent.ExecutionContext.Implicits$, scala.concurrent.ExecutionContext.parasitic$ -
Constructor Summary
ConstructorsConstructorDescriptionDispatcher(MessageDispatcherConfigurator _configurator, String id, int throughput, scala.concurrent.duration.Duration throughputDeadlineTime, ExecutorServiceFactoryProvider executorServiceFactoryProvider, scala.concurrent.duration.FiniteDuration shutdownTimeout) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanOverride this to define which runnables will be batched.protected org.apache.pekko.dispatch.MailboxcreateMailbox(Cell actor, MailboxType mailboxType) INTERNAL APIprotected voidINTERNAL APIprotected voidexecuteTask(TaskInvocation invocation) INTERNAL APIprotected final ExecutorServiceDelegateid()Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.protected booleanregisterForExecution(org.apache.pekko.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint) Returns if it was registeredprotected voidshutdown()INTERNAL APIscala.concurrent.duration.FiniteDurationWhen 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.confprotected voidsystemDispatch(org.apache.pekko.actor.ActorCell receiver, SystemMessage invocation) INTERNAL APIintINTERNAL APIscala.concurrent.duration.DurationINTERNAL APItoString()Methods inherited from class org.apache.pekko.dispatch.MessageDispatcher
actors, attach, configurator, debug, detach, eventStream, inhabitants, isThroughputDeadlineTimeDefined, mailboxes, printActors, register, reportFailure, RESCHEDULED, resubmitOnBlock, resume, SCHEDULED, suspend, unbatchedExecute, unregister, UNSCHEDULEDMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.dispatch.BatchingExecutor
executeMethods inherited from interface scala.concurrent.ExecutionContext
execute, prepare
-
Constructor Details
-
Dispatcher
public Dispatcher(MessageDispatcherConfigurator _configurator, String id, int throughput, scala.concurrent.duration.Duration throughputDeadlineTime, ExecutorServiceFactoryProvider executorServiceFactoryProvider, scala.concurrent.duration.FiniteDuration shutdownTimeout)
-
-
Method Details
-
batchable
Description copied from interface:BatchingExecutorOverride this to define which runnables will be batched. -
createMailbox
INTERNAL API- Specified by:
createMailboxin classMessageDispatcher
-
dispatch
INTERNAL API- Specified by:
dispatchin classMessageDispatcher
-
executeTask
INTERNAL API- Specified by:
executeTaskin classMessageDispatcher
-
executorService
-
id
Description copied from class:MessageDispatcherIdentifier of this dispatcher, corresponds to the full key of the dispatcher configuration.- Specified by:
idin classMessageDispatcher
-
registerForExecution
protected boolean registerForExecution(org.apache.pekko.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint) Returns if it was registeredINTERNAL API
- Specified by:
registerForExecutionin classMessageDispatcher
-
shutdown
protected void shutdown()INTERNAL API- Specified by:
shutdownin classMessageDispatcher
-
shutdownTimeout
public scala.concurrent.duration.FiniteDuration shutdownTimeout()Description copied from class:MessageDispatcherWhen 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.confINTERNAL API
- Specified by:
shutdownTimeoutin classMessageDispatcher
-
systemDispatch
INTERNAL API- Specified by:
systemDispatchin classMessageDispatcher
-
throughput
public int throughput()Description copied from class:MessageDispatcherINTERNAL API- Specified by:
throughputin classMessageDispatcher
-
throughputDeadlineTime
public scala.concurrent.duration.Duration throughputDeadlineTime()Description copied from class:MessageDispatcherINTERNAL API- Specified by:
throughputDeadlineTimein classMessageDispatcher
-
toString
-