Hi,
I am using Akka 2.2.1 .
I am looking up a remote actor using actorSelection using the code below.
def getActorRef(path: String, context: ActorContext, log:LoggingAdapter):
ActorRef = {
implicit val timeout = Timeout(30, TimeUnit.SECONDS);
val future = context.actorSelection(path).resolveOne().mapTo[ActorRef]
val futureTimeout = Duration(30, TimeUnit.SECONDS);
val actorRef =
try {
Await.result(future, futureTimeout)
} catch {
case ex: Exception => {
log.info("+++++ Not available :" + path)
context.actorOf(Props.empty)
}
}
actorRef
}
Is there a more elegant way (without catching an exception) of determining
if a remote actor is running ?
Thanks in advance for your assistance !
Shing
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.