Moved Scheduler to actors

This commit is contained in:
Viktor Klang 2009-09-07 18:41:45 +02:00
parent 46cff1a0a1
commit 7b9ffcc4ef
4 changed files with 11 additions and 11 deletions

View file

@ -16,18 +16,20 @@ import scala.collection.jcl.HashMap
object ActorRegistry extends Logging {
private val actors = new HashMap[String, List[Actor]]
def actorsFor(clazz: Class[_]): List[Actor] = synchronized {
actors.get(clazz.getName) match {
def actorsFor(fqn : String): List[Actor] = synchronized {
actors.get(fqn) match {
case None => Nil
case Some(instances) => instances
}
}
def actorsFor(clazz: Class[_]) : List[Actor] = actorsFor(clazz.getName)
def register(actor: Actor) = synchronized {
val name = actor.getClass.getName
actors.get(name) match {
case Some(instances) => actors + (name -> (actor :: instances))
case None => actors + (name -> (actor :: Nil))
case None => actors + (name -> (actor :: Nil))
}
}
}

View file

@ -11,11 +11,12 @@
* limitations under the License.
*/
package se.scalablesolutions.akka.util
package se.scalablesolutions.akka.actor
import java.util.concurrent._
import actor.{OneForOneStrategy, Actor}
import config.ScalaConfig._
import _root_.se.scalablesolutions.akka.util.{Logging}
import org.scala_tools.javautils.Imports._

View file

@ -4,9 +4,8 @@ import junit.framework.Test
import junit.framework.TestCase
import junit.framework.TestSuite
import actor.{ActorSpec, RemoteActorSpec, InMemoryActorSpec, SupervisorSpec, RemoteSupervisorSpec}
import actor.{ActorSpec, RemoteActorSpec, InMemoryActorSpec, SupervisorSpec, RemoteSupervisorSpec,SchedulerSpec}
import reactor.{EventBasedSingleThreadDispatcherTest, EventBasedThreadPoolDispatcherTest}
import util.SchedulerSpec
object AllTest extends TestCase {
def suite(): Test = {

View file

@ -1,6 +1,4 @@
package se.scalablesolutions.akka.util
import se.scalablesolutions.akka.actor.Actor
package se.scalablesolutions.akka.actor
import java.util.concurrent.TimeUnit