akka.dispatch
Class MessageDispatcher

java.lang.Object
  extended by akka.dispatch.MessageDispatcher
All Implemented Interfaces:
java.util.concurrent.Executor, scala.concurrent.ExecutionContext, scala.concurrent.ExecutionContextExecutor
Direct Known Subclasses:
Dispatcher

public abstract class MessageDispatcher
extends java.lang.Object
implements scala.concurrent.ExecutionContextExecutor


Nested Class Summary
 
Nested classes/interfaces inherited from interface scala.concurrent.ExecutionContext
scala.concurrent.ExecutionContext.Implicits$
 
Constructor Summary
MessageDispatcher(MessageDispatcherConfigurator configurator)
           
 
Method Summary
 java.lang.ThreadLocal<scala.collection.immutable.List<java.lang.Runnable>> _tasksLocal()
           
static Index<MessageDispatcher,ActorRef> actors()
           
 void attach(akka.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).
 boolean batchable(java.lang.Runnable runnable)
          Override this to define which runnables will be batched.
 MessageDispatcherConfigurator configurator()
           
protected abstract  akka.dispatch.Mailbox createMailbox(akka.actor.Cell actor, MailboxType mailboxType)
          Creates and returns a mailbox for the given actor.
static boolean debug()
           
 void detach(akka.actor.ActorCell actor)
          Detaches the specified actor instance from this dispatcher
protected abstract  void dispatch(akka.actor.ActorCell receiver, Envelope invocation)
          Will be called when the dispatcher is to queue an invocation for execution
 EventStream eventStream()
           
 void execute(java.lang.Runnable runnable)
           
protected abstract  void executeTask(TaskInvocation invocation)
          INTERNAL API
abstract  java.lang.String id()
          Identifier of this dispatcher, corresponds to the full key of the dispatcher configuration.
 long inhabitants()
           
protected  boolean isThroughputDeadlineTimeDefined()
          INTERNAL API
 akka.dispatch.Mailboxes mailboxes()
           
static void printActors()
           
protected  void register(akka.actor.ActorCell actor)
          If you override it, you must call it.
protected abstract  boolean registerForExecution(akka.dispatch.Mailbox mbox, boolean hasMessageHint, boolean hasSystemMessageHint)
          Suggest to register the provided mailbox for execution
 void reportFailure(java.lang.Throwable t)
           
static int RESCHEDULED()
           
protected  void resume(akka.actor.ActorCell actor)
           
static int SCHEDULED()
           
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
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 akka configs "akka.actor.default-dispatcher.shutdown-timeout" or default specified in reference.conf
protected  void suspend(akka.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(akka.actor.ActorCell receiver, akka.dispatch.sysmsg.SystemMessage invocation)
          Will be called when the dispatcher is to queue an invocation for execution
protected abstract  int throughput()
          INTERNAL API
protected abstract  scala.concurrent.duration.Duration throughputDeadlineTime()
          INTERNAL API
protected  void unbatchedExecute(java.lang.Runnable r)
           
protected  void unregister(akka.actor.ActorCell actor)
          If you override it, you must call it.
static int UNSCHEDULED()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface scala.concurrent.ExecutionContext
execute, prepare
 

Constructor Detail

MessageDispatcher

public MessageDispatcher(MessageDispatcherConfigurator configurator)
Method Detail

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 akka.dispatch.Mailboxes mailboxes()

eventStream

public EventStream eventStream()

inhabitants

public final long inhabitants()

createMailbox

protected abstract akka.dispatch.Mailbox createMailbox(akka.actor.Cell actor,
                                                       MailboxType mailboxType)
Creates and returns a mailbox for the given actor.


id

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


attach

public final void attach(akka.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(akka.actor.ActorCell actor)
Detaches the specified actor instance from this dispatcher


unbatchedExecute

protected final void unbatchedExecute(java.lang.Runnable r)

reportFailure

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

register

protected void register(akka.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(akka.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 akka configs "akka.actor.default-dispatcher.shutdown-timeout" or default specified in reference.conf

INTERNAL API


suspend

protected void suspend(akka.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(akka.actor.ActorCell actor)

systemDispatch

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

INTERNAL API


dispatch

protected abstract void dispatch(akka.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(akka.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


_tasksLocal

public java.lang.ThreadLocal<scala.collection.immutable.List<java.lang.Runnable>> _tasksLocal()

execute

public void execute(java.lang.Runnable runnable)
Specified by:
execute in interface java.util.concurrent.Executor

batchable

public boolean batchable(java.lang.Runnable runnable)
Override this to define which runnables will be batched.