I'm having some difficulty understanding some of the guarantees that the 
Akka framework provides.  The documentation states:

To prevent visibility and reordering problems on actors, Akka guarantees 
the following two "happens before" rules:

   - *The actor send rule*: the send of the message to an actor happens 
   before the receive of that message by the same actor. 
   - *The actor subsequent processing rule*: processing of one message 
   happens before processing of the next message by the same actor. 

Both rules only apply for the same actor instance and are *not valid if 
different actors are used*.

I understand the documentation but am wondering if anything is guaranteed 
about sending a message to a different actor.

The documentation also indicates that messages *should* (not must) be 
immutable.  If I send a mutable message to another actor, does the 
receiving actor run the risk of not seeing the fields that were set in the 
sending actor?

My java project deals with some pretty unwieldy model objects that have 40+ 
instance variables, but I'd like to pass those model objects between actors 
as fields on a message.  I can make the model object a final field on the 
message, but that obviously doesn't really make it immutable.  Making the 
fields of the model object final puts incredible bloat on the constructor, 
so I don't really consider that an option.  My reading of 
http://java.dzone.com/articles/memory-barriersfences indicates that the 
final keyword will enforce a store barrier, implying that as long as I set 
all of the fields on my model object *before* I set it as a message field, 
the message recipient should see a fully populated object - is that 
correct?  Even if the statement is true, I don't think that will be easy to 
enforce across my team.  Does Akka guarantee anything stronger?

I have the use case where I pass my (mutable) model object along to another 
actor who computes and sets some of the values on that model object before 
constructing a reply with it.  Is this a terrible idea in Akka, or is there 
a way to make it work?

-- 
>>>>>>>>>>      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.

Reply via email to