10 apr 2014 kl. 07:08 skrev Patrik Nordwall <[email protected]>:
> > > > On Wed, Apr 9, 2014 at 9:04 PM, Iain Hull <[email protected]> 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. 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 – Reactive 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]. > 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. > > > > -- > > Patrik Nordwall > Typesafe - Reactive apps on the JVM > Twitter: @patriknw > > JOIN US. REGISTER TODAY! > Scala > Days > June 16th-18th, > Berlin > > > -- > >>>>>>>>>> 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. Dr. Roland Kuhn Akka Tech Lead Typesafe – Reactive apps on the JVM. twitter: @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.
