an ActorRef will be returned for the running actor or an ActorRef that forwards messages to the dead letter actor will be returned. The path for both of these will be:
akka://MySystem/myparent/myactor
which means that I can't ever tell if I actually have an actor running. I can look up children from a parent using context.children.find(..... but as the docs mention
val badLookup = context.children find (_.path.name == "kid") // should better be expressed as: val goodLookup = context.actorFor("kid")
this is a slow way to look up actors especially if a parent has thousands/hundreds of thousands of children.
My path forward has been to keep a HashMap of the actor name and the actor ref and use context.watch( child ) to remove actors from the map when they shut themselves down.
Am I correct that there really isn't a way to look up a running actor in 2.0, and actually know if it is the actor you wanted?
On Fri, Apr 27, 2012 at 1:17 AM, andy <andrew.headr...@gmail.com> wrote:
> Hello,
> When looking up an actor
> context.actorFor( "myactor" )
> an ActorRef will be returned for the running actor or an ActorRef that
> forwards messages to the dead letter actor will be returned. The path for
> both of these will be:
> akka://MySystem/myparent/myactor
> which means that I can't ever tell if I actually have an actor running.
Which makes total sense because in an asynchronous environment something
might die the same nanosecond you look at it, or a nanosecond later.
use watch() and unwatch() or in rare cases "isTerminated" to observe death.
> I can look up children from a parent using context.children.find(..... but
> as the docs mention
> val badLookup = context.children find (_.path.name == "kid")
> // should better be expressed as:
> val goodLookup = context.actorFor("kid")
> this is a slow way to look up actors especially if a parent has
> thousands/hundreds of thousands of children.
See above
> My path forward has been to keep a HashMap of the actor name and the actor
> ref and use context.watch( child ) to remove actors from the map when they
> shut themselves down.
See above.
> Am I correct that there really isn't a way to look up a running actor in
> 2.0, and actually know if it is the actor you wanted?
See above.
Cheers,
√
> Thanks,
> Andy
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
> To post to this group, send email to akka-user@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.
-- Viktor Klang
Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale
On Thursday, April 26, 2012 4:25:22 PM UTC-7, √ wrote:
> Hey Andy,
> On Fri, Apr 27, 2012 at 1:17 AM, andy <andrew.headr...@gmail.com> wrote:
>> Hello,
>> When looking up an actor
>> context.actorFor( "myactor" )
>> an ActorRef will be returned for the running actor or an ActorRef that >> forwards messages to the dead letter actor will be returned. The path for >> both of these will be:
>> akka://MySystem/myparent/myactor
>> which means that I can't ever tell if I actually have an actor running.
> Which makes total sense because in an asynchronous environment something > might die the same nanosecond you look at it, or a nanosecond later.
> use watch() and unwatch() or in rare cases "isTerminated" to observe death.
>> I can look up children from a parent using context.children.find(..... >> but as the docs mention
>> val badLookup = context.children find (_.path.name == "kid")
>> // should better be expressed as:
>> val goodLookup = context.actorFor("kid")
>> this is a slow way to look up actors especially if a parent has >> thousands/hundreds of thousands of children.
> See above
>> My path forward has been to keep a HashMap of the actor name and the >> actor ref and use context.watch( child ) to remove actors from the map when >> they shut themselves down.
> See above.
>> Am I correct that there really isn't a way to look up a running actor in >> 2.0, and actually know if it is the actor you wanted?
> See above.
> Cheers,
> √
>> Thanks,
>> Andy
>> -- >> You received this message because you are subscribed to the Google Groups >> "Akka User List" group.
>> To view this discussion on the web visit >> https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
>> To post to this group, send email to akka-user@googlegroups.com.
>> To unsubscribe from this group, send email to >> akka-user+unsubscribe@googlegroups.com.
>> For more options, visit this group at >> http://groups.google.com/group/akka-user?hl=en.
> -- > Viktor Klang
> Akka Tech Lead
> Typesafe <http://www.typesafe.com/> - The software stack for applications > that scale
On Fri, Apr 27, 2012 at 1:28 AM, andy <andrew.headr...@gmail.com> wrote:
> Killer thanks. Just making sure. I'm battling the upgrade beast and I
> almost have it licked.
> On Thursday, April 26, 2012 4:25:22 PM UTC-7, √ wrote:
>> Hey Andy,
>> On Fri, Apr 27, 2012 at 1:17 AM, andy <andrew.headr...@gmail.com> wrote:
>>> Hello,
>>> When looking up an actor
>>> context.actorFor( "myactor" )
>>> an ActorRef will be returned for the running actor or an ActorRef that
>>> forwards messages to the dead letter actor will be returned. The path for
>>> both of these will be:
>>> akka://MySystem/myparent/**myactor
>>> which means that I can't ever tell if I actually have an actor running.
>> Which makes total sense because in an asynchronous environment something
>> might die the same nanosecond you look at it, or a nanosecond later.
>> use watch() and unwatch() or in rare cases "isTerminated" to observe
>> death.
>>> I can look up children from a parent using context.children.find(.....
>>> but as the docs mention
>>> val badLookup = context.children find (_.path.name == "kid")
>>> // should better be expressed as:
>>> val goodLookup = context.actorFor("kid")
>>> this is a slow way to look up actors especially if a parent has
>>> thousands/hundreds of thousands of children.
>> See above
>>> My path forward has been to keep a HashMap of the actor name and the
>>> actor ref and use context.watch( child ) to remove actors from the map when
>>> they shut themselves down.
>> See above.
>>> Am I correct that there really isn't a way to look up a running actor in
>>> 2.0, and actually know if it is the actor you wanted?
>> See above.
>> Cheers,
>> √
>>> Thanks,
>>> Andy
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/akka-user/-/IgiXQuy_y3cJ<https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ>
>>> .
>>> To post to this group, send email to akka-user@googlegroups.com.
>>> To unsubscribe from this group, send email to akka-user+unsubscribe@**
>>> googlegroups.com <akka-user%2Bunsubscribe@googlegroups.com>.
>>> For more options, visit this group at http://groups.google.com/** >>> group/akka-user?hl=en <http://groups.google.com/group/akka-user?hl=en>.
>> --
>> Viktor Klang
>> Akka Tech Lead
>> Typesafe <http://www.typesafe.com/> - The software stack for
>> applications that scale
> To post to this group, send email to akka-user@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.
-- Viktor Klang
Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale
> an ActorRef will be returned for the running actor or an ActorRef that forwards messages to the dead letter actor will be returned. The path for both of these will be:
> akka://MySystem/myparent/myactor
> which means that I can't ever tell if I actually have an actor running. I can look up children from a parent using context.children.find(..... but as the docs mention
> val badLookup = context.children find (_.path.name == "kid")
> // should better be expressed as:
> val goodLookup = context.actorFor("kid")
> this is a slow way to look up actors especially if a parent has thousands/hundreds of thousands of children.
> My path forward has been to keep a HashMap of the actor name and the actor ref and use context.watch( child ) to remove actors from the map when they shut themselves down.
> Am I correct that there really isn't a way to look up a running actor in 2.0, and actually know if it is the actor you wanted?
> Thanks,
> Andy
> -- > You received this message because you are subscribed to the Google Groups "Akka User List" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
> To post to this group, send email to akka-user@googlegroups.com.
> To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
> let me add that context.actorFor already does the book-keeping including DeathWatch, so just use
> context.actorFor("blah").isTerminated
> That is the most efficient way.
> Regards,
> Roland Kuhn
> Typesafe — The software stack for applications that scale
> twitter: @rolandkuhn
> On 27 apr 2012, at 01:17, andy <andrew.headr...@gmail.com> wrote:
>> Hello,
>> When looking up an actor
>> context.actorFor( "myactor" )
>> an ActorRef will be returned for the running actor or an ActorRef that forwards messages to the dead letter actor will be returned. The path for both of these will be:
>> akka://MySystem/myparent/myactor
>> which means that I can't ever tell if I actually have an actor running. I can look up children from a parent using context.children.find(..... but as the docs mention
>> val badLookup = context.children find (_.path.name == "kid")
>> // should better be expressed as:
>> val goodLookup = context.actorFor("kid")
>> this is a slow way to look up actors especially if a parent has thousands/hundreds of thousands of children.
>> My path forward has been to keep a HashMap of the actor name and the actor ref and use context.watch( child ) to remove actors from the map when they shut themselves down.
>> Am I correct that there really isn't a way to look up a running actor in 2.0, and actually know if it is the actor you wanted?
>> Thanks,
>> Andy
>> -- >> You received this message because you are subscribed to the Google Groups "Akka User List" group.
>> To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
>> To post to this group, send email to akka-user@googlegroups.com.
>> To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
> -- > You received this message because you are subscribed to the Google Groups "Akka User List" group.
> To post to this group, send email to akka-user@googlegroups.com.
> To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.