Package akka.dispatch
Class Dispatcher
- java.lang.Object
-
- akka.dispatch.MessageDispatcher
-
- akka.dispatch.Dispatcher
-
- All Implemented Interfaces:
BatchingExecutor,java.util.concurrent.Executor,scala.concurrent.ExecutionContext,scala.concurrent.ExecutionContextExecutor
- Direct Known Subclasses:
PinnedDispatcher
public class Dispatcher extends MessageDispatcher
The event-basedDispatcherbinds a set of Actors to a thread pool backed up by aBlockingQueue.The preferred way of creating dispatchers is to define configuration of it and use the the
lookupmethod inDispatchers.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
-
-
Constructor Summary
Constructors Constructor Description Dispatcher(MessageDispatcherConfigurator _configurator, java.lang.String id, int throughput, scala.concurrent.duration.Duration throughputDeadlineTime, ExecutorServiceFactoryProvider executorServiceFactoryProvider, scala.concurrent.duration.FiniteDuration shutdownTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbatchable(java.lang.Runnable runnable)Override this to define which runnables will be batched.protected akka.dispatch.MailboxcreateMailbox(Cell actor, MailboxType mailboxType)INTERNAL APIprotected voiddispatch(akka.actor.ActorCell receiver, Envelope invocation)INTERNAL APIprotected voidexecuteTask(TaskInvocation invocation)INTERNAL APIprotected ExecutorServiceDelegateexecutorService()java.lang.Stringid()Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.protected booleanregisterForExecution(akka.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint)Returns if it was registeredprotected voidshutdown()INTERNAL APIscala.concurrent.duration.FiniteDurationshutdownTimeout()When the dispatcher no longer has any actors registered, how long will it wait until it shuts itself down, defaulting to your akka configs "akka.actor.default-dispatcher.shutdown-timeout" or default specified in reference.confprotected voidsystemDispatch(akka.actor.ActorCell receiver, SystemMessage invocation)INTERNAL APIintthroughput()INTERNAL APIscala.concurrent.duration.DurationthroughputDeadlineTime()INTERNAL APIjava.lang.StringtoString()-
Methods inherited from class akka.dispatch.MessageDispatcher
actors, attach, configurator, debug, detach, eventStream, inhabitants, isThroughputDeadlineTimeDefined, mailboxes, printActors, register, reportFailure, RESCHEDULED, resubmitOnBlock, resume, SCHEDULED, suspend, unbatchedExecute, unregister, UNSCHEDULED
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.dispatch.BatchingExecutor
execute
-
-
-
-
Constructor Detail
-
Dispatcher
public Dispatcher(MessageDispatcherConfigurator _configurator, java.lang.String id, int throughput, scala.concurrent.duration.Duration throughputDeadlineTime, ExecutorServiceFactoryProvider executorServiceFactoryProvider, scala.concurrent.duration.FiniteDuration shutdownTimeout)
-
-
Method Detail
-
batchable
public boolean batchable(java.lang.Runnable runnable)
Description copied from interface:BatchingExecutorOverride this to define which runnables will be batched.
-
createMailbox
protected akka.dispatch.Mailbox createMailbox(Cell actor, MailboxType mailboxType)
INTERNAL API- Specified by:
createMailboxin classMessageDispatcher
-
dispatch
protected void dispatch(akka.actor.ActorCell receiver, Envelope invocation)INTERNAL API- Specified by:
dispatchin classMessageDispatcher
-
executeTask
protected void executeTask(TaskInvocation invocation)
INTERNAL API- Specified by:
executeTaskin classMessageDispatcher
-
executorService
protected final ExecutorServiceDelegate executorService()
-
id
public java.lang.String 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(akka.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 akka configs "akka.actor.default-dispatcher.shutdown-timeout" or default specified in reference.confINTERNAL API
- Specified by:
shutdownTimeoutin classMessageDispatcher
-
systemDispatch
protected void systemDispatch(akka.actor.ActorCell receiver, SystemMessage invocation)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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-