Hi Nils, it should be mentioned that you can keep the child actors from being stopped by overriding the preRestart hook <http://doc.akka.io/docs/akka/2.3.7/scala/actors.html#Restart_Hooks>. The default is to kill child actors because they can be regarded as part of the parent’s state, but there may well be cases where that is not true; you’ll need to think about whether the old child still makes sense under the new (restarted) parent.
Regards, Roland > 13 nov 2014 kl. 08:34 skrev [email protected]: > > Yes, it is a child actor started in preStart higher up in the hierarchy. So I > guess it's safe to assume that the uid is supposed to change in this > scenario. The actual case I'm trying to solve is that an actor spawns a > future, and before the future has completed, the actor might have restarted > (or rather stopped and started). In that case, the result of the future > should then be ignored, which is currently is not, since the ActorRef the > future reference is still valid after the restart. > > Nils-H > > On Thursday, November 13, 2014 3:20:31 PM UTC+1, Martynas Mickevičius wrote: > Hi Nils, > > actor UID does not change if that actor is restarted by the Supervision > Strategy of its parent. > > Maybe in your situation child's parent was restarted because of child's > parent's parent supervision strategy? In that case child UID would have been > changed, because child would not have been restarted but rather stopped (and > started again, if that is in the child's parent preStart or constructor code). > > The above is quite speculative because I am not sure about actor hierarchy in > your program. If that does not make sense please provide more information > about your use case. > > On Wed, Nov 12, 2014 at 10:04 AM, <[email protected] <javascript:>> wrote: > It's not quite clear to me at which point an ActorRef changes it's uid. The > doc says: > > "An actor incarnation is identified by the path and a UID. A restart only > swaps the Actor instance defined by the Props but the incarnation and hence > the UID remains the same." > > I have a child actor that is restarted by a parent (due to an exception and > the supervisor strategy), and when it is restarted, the uid also changes, > which is not how I read the above statement? I was planning to use the uid in > a Future that is spawned by the actor, to make sure that the actor instance > is the same when the future completes, as the actor could have been restarted > while the future is running. Would it be considered to be an anti pattern to > use and rely on the uid this way, or is it a valid approach? > > Nils-H > > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <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] <javascript:>. > To post to this group, send email to [email protected] <javascript:>. > Visit this group at http://groups.google.com/group/akka-user > <http://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > > -- > Martynas Mickevičius > Typesafe <http://typesafe.com/> – Reactive > <http://www.reactivemanifesto.org/> Apps on the JVM > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/akka-user > <http://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. Dr. Roland Kuhn Akka Tech Lead Typesafe <http://typesafe.com/> – Reactive apps on the JVM. twitter: @rolandkuhn <http://twitter.com/#!/rolandkuhn> -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> 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/d/optout.
