Remote DeathWatch (2): make it work

- introduce EmptyLocalActorRef, which is returned for unsuccessful
  look-ups of local scope
- this fixes the problem that actors—after their death—can still be
  looked up without losing their identity; otherwise behave like
  DeadLetterActorRef
- adapt tests accordingly
- make DeathWatchSpec reusable and build remote test from it
- remove several unused imports of LocalActorRef
- use LocalRef/RemoteRef in pattern matches where applicable: these are
  marker traits for a ref’s scope; InternalActorRef mandates a scope as
  per its self-type
This commit is contained in:
Roland 2011-12-29 16:27:32 +01:00
parent b15f4a2f1a
commit 0ed6a67e08
16 changed files with 147 additions and 59 deletions

View file

@ -0,0 +1,33 @@
/**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
package akka.remote
import akka.testkit._
import akka.actor.{ ActorSystem, DeathWatchSpec }
import com.typesafe.config.ConfigFactory
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class RemoteDeathWatchSpec extends AkkaSpec(ConfigFactory.parseString("""
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
deployment {
/watchers.remote = "akka://other@127.0.0.1:2666"
}
}
cluster.nodename = buh
remote.server {
hostname = "127.0.0.1"
port = 2665
}
}
""")) with ImplicitSender with DefaultTimeout with DeathWatchSpec {
val other = ActorSystem("other", ConfigFactory.parseString("akka.remote.server.port=2666").withFallback(system.settings.config))
override def atTermination() {
other.shutdown()
}
}