I am using Akka 2.10 with JAVA.
I have a method that links to an Actor link for me - or create one if it wasnโt before - but sometimes, when I try to create one, I get the following exception:
akka.actor.InvalidActorNameException: actor name [<ActorName>] is not unique! at akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.reserve(ChildrenContainer.scala:130) at akka.actor.dungeon.Children$class.reserveChild(Children.scala:77) at akka.actor.ActorCell.reserveChild(ActorCell.scala:369) at akka.actor.dungeon.Children$class.makeChild(Children.scala:202) at akka.actor.dungeon.Children$class.attachChild(Children.scala:42) at akka.actor.ActorCell.attachChild(ActorCell.scala:369) at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:552)
Of course, I know that the exception is very clear: I try to create more than one actor with the same identifier, but I just do it when I can not find the link to the actor. With time:
private static ActorRef getActor(String id,Class actor) throws Exception{ ActorSelection sel = system.actorSelection(system.child(id)); Timeout t = new Timeout(4, TimeUnit.SECONDS); AskableActorSelection asker = new AskableActorSelection(sel); scala.concurrent.Future<Object> fut = asker.ask(new Identify(1), t); ActorRef actorClient = null; try{
I wait 4 seconds without an answer ... so I create a new one.
I searched the Internet through a solution for my business, but to no avail ...
Can someone help me solve this problem?
Thank you so much!
java actor akka playframework
Elvis oliveira
source share