|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.dispatch.MessageDispatcher akka.dispatch.Dispatcher akka.dispatch.BalancingDispatcher
public class BalancingDispatcher
An executor based event driven dispatcher which will try to redistribute work from busy actors to idle actors. It is assumed that all actors using the same instance of this dispatcher can process all messages that have been sent to one of the actors. I.e. the actors belong to a pool of actors, and to the client there is no guarantee about which actor instance actually processes a given message.
Although the technique used in this implementation is commonly known as "work stealing", the actual implementation is probably best described as "work donating" because the actor of which work is being stolen takes the initiative. The preferred way of creating dispatchers is to define configuration of it and use the thelookup
method in Dispatchers
.
BalancingDispatcher
,
Dispatchers
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface scala.concurrent.ExecutionContext |
---|
scala.concurrent.ExecutionContext.Implicits$ |
Constructor Summary | |
---|---|
BalancingDispatcher(DispatcherPrerequisites _prerequisites,
java.lang.String _id,
int throughput,
scala.concurrent.duration.Duration throughputDeadlineTime,
MailboxType mailboxType,
ExecutorServiceFactoryProvider _executorServiceFactoryProvider,
scala.concurrent.duration.FiniteDuration _shutdownTimeout,
boolean attemptTeamWork)
|
Method Summary | |
---|---|
java.lang.ThreadLocal<scala.collection.immutable.List<java.lang.Runnable>> |
_tasksLocal()
|
boolean |
batchable(java.lang.Runnable runnable)
Override this to define which runnables will be batched. |
protected akka.dispatch.Mailbox |
createMailbox(akka.actor.Cell actor)
INTERNAL USE ONLY |
protected void |
dispatch(akka.actor.ActorCell receiver,
Envelope invocation)
INTERNAL USE ONLY |
void |
execute(java.lang.Runnable runnable)
|
MessageQueue |
messageQueue()
INTERNAL USE ONLY |
protected void |
register(akka.actor.ActorCell actor)
If you override it, you must call it. |
java.util.concurrent.ConcurrentSkipListSet<akka.actor.ActorCell> |
team()
INTERNAL USE ONLY |
protected void |
teamWork()
|
protected void |
unregister(akka.actor.ActorCell actor)
If you override it, you must call it. |
Methods inherited from class akka.dispatch.Dispatcher |
---|
executeTask, executorService, id, mailboxType, registerForExecution, shutdown, shutdownTimeout, systemDispatch, throughput, throughputDeadlineTime, toString |
Methods inherited from class akka.dispatch.MessageDispatcher |
---|
actors, attach, debug, defaultDispatcher, detach, inhabitants, isThroughputDeadlineTimeDefined, prerequisites, printActors, reportFailure, RESCHEDULED, resume, SCHEDULED, suspend, unbatchedExecute, UNSCHEDULED |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface scala.concurrent.ExecutionContext |
---|
execute, prepare |
Constructor Detail |
---|
public BalancingDispatcher(DispatcherPrerequisites _prerequisites, java.lang.String _id, int throughput, scala.concurrent.duration.Duration throughputDeadlineTime, MailboxType mailboxType, ExecutorServiceFactoryProvider _executorServiceFactoryProvider, scala.concurrent.duration.FiniteDuration _shutdownTimeout, boolean attemptTeamWork)
Method Detail |
---|
public java.util.concurrent.ConcurrentSkipListSet<akka.actor.ActorCell> team()
public MessageQueue messageQueue()
protected akka.dispatch.Mailbox createMailbox(akka.actor.Cell actor)
Dispatcher
createMailbox
in class Dispatcher
protected void register(akka.actor.ActorCell actor)
MessageDispatcher
INTERNAL API
register
in class MessageDispatcher
protected void unregister(akka.actor.ActorCell actor)
MessageDispatcher
INTERNAL API
unregister
in class MessageDispatcher
protected void dispatch(akka.actor.ActorCell receiver, Envelope invocation)
Dispatcher
dispatch
in class Dispatcher
protected void teamWork()
public java.lang.ThreadLocal<scala.collection.immutable.List<java.lang.Runnable>> _tasksLocal()
public void execute(java.lang.Runnable runnable)
execute
in interface java.util.concurrent.Executor
public boolean batchable(java.lang.Runnable runnable)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |