Documentation and some cleanup.

This commit is contained in:
Jan Van Besien 2010-03-07 09:44:03 +01:00
parent 41e7d131c6
commit 8a462095a4
3 changed files with 19 additions and 6 deletions

View file

@ -49,7 +49,7 @@ package se.scalablesolutions.akka.dispatch
* <p/>
*
* 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 <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/

View file

@ -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.
* <p/>
* 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

View file

@ -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")