Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Looking up actors in 2.0
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
andy  
View profile  
 More options Apr 26 2012, 7:17 pm
From: andy <andrew.headr...@gmail.com>
Date: Thu, 26 Apr 2012 16:17:50 -0700 (PDT)
Local: Thurs, Apr 26 2012 7:17 pm
Subject: Looking up actors in 2.0

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
√iktor Ҡlang  
View profile  
 More options Apr 26 2012, 7:25 pm
From: √iktor Ҡlang <viktor.kl...@gmail.com>
Date: Fri, 27 Apr 2012 01:25:22 +0200
Local: Thurs, Apr 26 2012 7:25 pm
Subject: Re: [akka-user] Looking up actors in 2.0

Hey Andy,

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

Twitter: @viktorklang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
andy  
View profile  
 More options Apr 26 2012, 7:28 pm
From: andy <andrew.headr...@gmail.com>
Date: Thu, 26 Apr 2012 16:28:07 -0700 (PDT)
Local: Thurs, Apr 26 2012 7:28 pm
Subject: Re: [akka-user] Looking up actors in 2.0

Killer thanks. Just making sure. I'm battling the upgrade beast and I
almost have it licked.

-Andy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
√iktor Ҡlang  
View profile  
 More options Apr 26 2012, 7:32 pm
From: √iktor Ҡlang <viktor.kl...@gmail.com>
Date: Fri, 27 Apr 2012 01:32:44 +0200
Local: Thurs, Apr 26 2012 7:32 pm
Subject: Re: [akka-user] Looking up actors in 2.0

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.

You're welcome,

happy hAkking

Cheers,

--
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland Kuhn  
View profile  
 More options Apr 27 2012, 3:12 am
From: Roland Kuhn <goo...@rkuhn.info>
Date: Fri, 27 Apr 2012 09:12:27 +0200
Local: Fri, Apr 27 2012 3:12 am
Subject: Re: [akka-user] Looking up actors in 2.0

Hi Andy,

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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland Kuhn  
View profile  
 More options Apr 27 2012, 3:16 am
From: Roland Kuhn <goo...@rkuhn.info>
Date: Fri, 27 Apr 2012 09:16:07 +0200
Local: Fri, Apr 27 2012 3:16 am
Subject: Re: [akka-user] Looking up actors in 2.0

just to be clear: the book-keeping is done only for direct children.

On 27 apr 2012, at 09:12, Roland Kuhn <goo...@rkuhn.info> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »