I have an actor defined like this:
class nodeActor(ID: String) extends Actor
which contains the method that is used to configure the actor before launching it:
def addRef(actor:ActorRef)
I create an instance of this actor like this:
val node1 = system.actorOf(Props(new nodeActor("node1")), name="node1")
which returns me an ActorRef. The compiler does not allow me to call "addRef" in ActorRef because it is a member of a subtype. So I used node using:
node1.asInstanceOf[nodeActor].addRef(link1)
This makes the compiler happy. Then at runtime I get
java.lang.ClassCastException: akka.actor.LocalActorRef cannot be cast to ActorStressTest.nodeActor
which, in my opinion, does not even make sense to me, since it is a subtype, and I should be able to pounce on it.
Ideas?
scala actor akka
Alex
source share