All children actors are stopped when the parent is restarted. The information what the children of the previous actor incarnation were is not useful, because they no loner exist by the time then next incarnation of the parent actor is created. The new incarnation proceeds to create it's children actors as needed. That's one of the crucial element's of Akka fault tolerance approach succinctly summarized as "Let it crash". It prevents actor instance leaks and makes application code simpler: recreating a part of actor hierarchy in known good state after a failure is much easier than trying to recover and patch together remaining bits of state.
W dniu piątek, 10 lutego 2017 03:40:48 UTC+1 użytkownik Achin Gupta napisał: > > My use case is: > > Before restart, there are let say 5 children of a parent. Now, i wish to > calculate performance and to calculate performance i need participation > from all these 5 children. So, after restart, i could just send the same > message to all children, after which children will work and respond to > parent. However, after restart, i am not even aware of who the children > were. So, what's the best way to solve these type of problems? > > On Thursday, 9 February 2017 22:28:50 UTC+5:30, Achin Gupta wrote: >> >> Thank you for the reply. >> And, i understand that in preRestart, the parent unwatches the child. >> And, hence if i override this method to do nothing, i should get the >> context.children() value correct. But when i tried doing so, i still see >> empty collection. Not sure what i am doing wrong. >> >> On Thursday, 9 February 2017 22:14:48 UTC+5:30, Rafał Krzewski wrote: >>> >>> Check preRestart method implementation as described in >>> http://doc.akka.io/docs/akka/2.4/scala/actors.html#Actor_API >>> It should answer your question :) >>> >>> Cheers, >>> Rafał >>> >>> W dniu czwartek, 9 lutego 2017 17:18:24 UTC+1 użytkownik Achin Gupta >>> napisał: >>>> >>>> When the System is restarted, the context.children() call returns zero >>>> children for a particular parent. Before restart, context.children() >>>> returned the actual count of children that parent had. >>>> >>>> Can someone please let me know how can we get the children ActorRef for >>>> a parent after restart? >>>> >>> -- >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.