Rewrote the dispatcher APIs and internals, now event-based dispatchers are 10x faster and much faster than Scala Actors. Added Executor and ForkJoin based dispatchers. Added a bunch of dispatcher tests. Added performance test

This commit is contained in:
Jonas Bonér 2009-12-11 16:37:44 +01:00
parent b5c9c6a57f
commit 2b2f03729e
27 changed files with 937 additions and 501 deletions

View file

@ -6,12 +6,15 @@ import junit.framework.TestCase
import org.scalatest.junit.JUnitSuite
import org.junit.Test
import se.scalablesolutions.akka.nio.{RemoteNode, RemoteServer, RemoteClient}
import se.scalablesolutions.akka.nio.{RemoteNode, RemoteServer}
import se.scalablesolutions.akka.dispatch.Dispatchers
object Global {
var oneWay = "nada"
}
class RemoteActorSpecActorUnidirectional extends Actor {
dispatcher = Dispatchers.newThreadBasedDispatcher(this)
def receive = {
case "OneWay" =>
Global.oneWay = "received"
@ -19,6 +22,8 @@ class RemoteActorSpecActorUnidirectional extends Actor {
}
class RemoteActorSpecActorBidirectional extends Actor {
dispatcher = Dispatchers.newThreadBasedDispatcher(this)
def receive = {
case "Hello" =>
reply("World")
@ -42,7 +47,6 @@ class RemoteActorTest extends JUnitSuite {
@Test
def shouldSendOneWay = {
implicit val timeout = 500000000L
val actor = new RemoteActorSpecActorUnidirectional
actor.makeRemote(RemoteServer.HOSTNAME, RemoteServer.PORT)
actor.start
@ -54,7 +58,6 @@ class RemoteActorTest extends JUnitSuite {
@Test
def shouldSendReplyAsync = {
implicit val timeout = 500000000L
val actor = new RemoteActorSpecActorBidirectional
actor.makeRemote(RemoteServer.HOSTNAME, RemoteServer.PORT)
actor.start