From 8a462095a42dc929ca143dd2cfbfde078c3088a0 Mon Sep 17 00:00:00 2001 From: Jan Van Besien Date: Sun, 7 Mar 2010 09:44:03 +0100 Subject: [PATCH] Documentation and some cleanup. --- .../ExecutorBasedEventDrivenDispatcher.scala | 2 +- ...asedEventDrivenWorkStealingDispatcher.scala | 18 +++++++++++++++--- ...EventDrivenWorkStealingDispatcherTest.scala | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenDispatcher.scala index 335e4051a3..77f16954d6 100644 --- a/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenDispatcher.scala @@ -49,7 +49,7 @@ package se.scalablesolutions.akka.dispatch *

* * But the preferred way of creating dispatchers is to use - * the { @link se.scalablesolutions.akka.dispatch.Dispatchers } factory object. + * the {@link se.scalablesolutions.akka.dispatch.Dispatchers} factory object. * * @author Jonas Bonér */ diff --git a/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala b/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala index 30d77998f9..f19fcce8fb 100644 --- a/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala @@ -6,18 +6,30 @@ package se.scalablesolutions.akka.dispatch import scala.collection.jcl.MutableIterator.Wrapper import se.scalablesolutions.akka.actor.Actor -import java.util.concurrent.ConcurrentHashMap /** - * TODO: doc + * 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. + *

+ * The preferred way of creating dispatchers is to use + * the {@link se.scalablesolutions.akka.dispatch.Dispatchers} factory object. + * + * * TODO: make sure everything in the pool is the same type of actor * + * TODO: make the work stealing a bit more clever. Find a way to only send new work to an actor if that actor will actually be scheduled + * immidiately afterwards. Otherwize the work gets a change of being stolen back again... which is not optimal. + * + * @see se.scalablesolutions.akka.dispatch.ExecutorBasedEventDrivenWorkStealingDispatcher + * @see se.scalablesolutions.akka.dispatch.Dispatchers + * * @author Jan Van Besien */ class ExecutorBasedEventDrivenWorkStealingDispatcher(_name: String) extends MessageDispatcher with ThreadPoolBuilder { @volatile private var active: Boolean = false - // TODO: how to construct this name + // TODO: is there a naming convention for this name? val name: String = "event-driven-work-stealing:executor:dispatcher:" + _name init diff --git a/akka-core/src/test/scala/ExecutorBasedEventDrivenWorkStealingDispatcherTest.scala b/akka-core/src/test/scala/ExecutorBasedEventDrivenWorkStealingDispatcherTest.scala index 03f9a02848..1ee23dc02f 100644 --- a/akka-core/src/test/scala/ExecutorBasedEventDrivenWorkStealingDispatcherTest.scala +++ b/akka-core/src/test/scala/ExecutorBasedEventDrivenWorkStealingDispatcherTest.scala @@ -5,9 +5,10 @@ import org.junit.Test import java.util.concurrent.CountDownLatch import org.scalatest.matchers.MustMatchers import se.scalablesolutions.akka.dispatch.Dispatchers -import java.util.Random - +/** + * @author Jan Van Besien + */ class ExecutorBasedEventDrivenWorkStealingDispatcherTest extends JUnitSuite with MustMatchers with ActorTestUtil { val poolDispatcher = Dispatchers.newExecutorBasedEventDrivenWorkStealingDispatcher("pooled-dispatcher")