Thanks for your answers, it makes perfect sense now. Although I am a little disappointed as this means my goal of abstracting a common restart pattern into into a separate actor is fruitless. However I will look for another approach.
On Thursday, 10 April 2014 13:25:48 UTC+1, √ wrote: > > > > > On Thu, Apr 10, 2014 at 2:00 PM, Roland Kuhn <[email protected]<javascript:> > > wrote: > >> >> 10 apr 2014 kl. 07:08 skrev Patrik Nordwall >> <[email protected]<javascript:> >> >: >> >> >> >> >> On Wed, Apr 9, 2014 at 9:04 PM, Iain Hull <[email protected]<javascript:> >> > wrote: >> >>> Hi Martynas, >>> >>> Thank you for you fix. This does indeed fix my case and I am very happy >>> change me code accordingly. >>> >>> However can you expand on the semantics of watch? Is it only safe to >>> call watch from the same actor that calls stop? Or is it only safe to >>> recreate a dead actor if the watch was called from the same actor as stop? >>> >>> The documentation says >>> >>> It should be noted that the Terminated message is generated independent >>>> of the order in which registration and termination occur. In particular, >>>> the watching actor will receive a Terminated message even if the >>>> watched actor has already been terminated at the time of registration. >>>> >>> >>> In my case when the watch and the stop are performed by different actors >>> the Terminated message is sent as expected, however it is not safe to >>> recreated the terminated actor in response to this message. >>> >> >> I think the only thing that is guaranteed is that if the parent watch a >> child it should be able to create a new child with the same name after it >> has received Terminated. In your code it is another actor that is watching, >> and it might see Terminated before the parent knows about it. >> >> >> Yes, this is exactly the reason. This demonstrates quite directly what it >> means that actors are only consistent on the inside; between actors there >> is at most eventual consistency. >> >> > Very good point. It clearly demonstrate that news does not travel faster > than the speed of light. > > >> Regards, >> >> Roland >> >> >> /Patrik >> >> >>> Am I missing something regarding when these affects are visible or >>> should be this behavior be documented? >>> >>> Iain. >>> >>> >>> On Wednesday, 9 April 2014 15:04:32 UTC+1, Martynas Mickevičius wrote: >>>> >>>> Hi Iain, >>>> >>>> I think the problem could be in your code here: >>>> >>>> deathReporter ! DeathReportActor.Watch(fated, self, Create(value)) >>>> context.system.stop(fated) >>>> >>>> Here I can see a race condition. In some cases *fated* actor can be >>>> stopped before *Watch* message in handled. So *DeathReportActor* never >>>> gets *Terminated* message. If I move >>>> >>>> context.system.stop(fated) >>>> >>>> to *DeathReportActor* after *watch* call >>>> >>>> context.watch(fated) >>>> context.system.stop(fated) >>>> >>>> then your test case passes. >>>> >>>> -- >>>> Martynas Mickevičius >>>> Typesafe <http://typesafe.com/> – >>>> Reactive<http://www.reactivemanifesto.org/> Apps >>>> on the JVM >>>> >>> >>> -- >>> >>>>>>>>>> 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] <javascript:>. >>> To post to this group, send email to [email protected]<javascript:> >>> . >>> Visit this group at http://groups.google.com/group/akka-user. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> Patrik Nordwall >> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >> Twitter: @patriknw >> JOIN US. REGISTER TODAY! <http://www.scaladays.org/> >> Scala <http://www.scaladays.org/> >> Days <http://www.scaladays.org/> >> June 16th-18th, <http://www.scaladays.org/> >> Berlin <http://www.scaladays.org/> >> >> >> -- >> >>>>>>>>>> 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] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit 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] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Cheers, > √ > -- >>>>>>>>>> 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.
