Mutable messages for Actors?

152 views
Skip to first unread message

John Antypas

unread,
Jan 28, 2013, 9:20:43 PM1/28/13
to akka...@googlegroups.com
This is likely a very dumb question, but, everyone has been very helpful on the dynamic loading piece, and before I come up with a very dumb answer.....

If I have a series of actors, some of which could be remote, and I want to pass them a message such as the following

class MyMessage (
       var lastIndex : Integer = 0
        ,,,,
)

Am I correct that this is an issue?   The message is mutable, is there a case where a message could be in a "synchronization crisis"?   I can't imagine, if I'm passing this around, that two actors could be working on this message, but given it's mutable, it could happen.   This is the wrong way to do things I suppose.

Jonas Bonér

unread,
Jan 29, 2013, 8:21:30 AM1/29/13
to akka...@googlegroups.com
There are no dumb questions on this ML.
If you just do a safe handoff i.e. let go of and never touch the
message after you have sent it off, then you are fine.
But it is as you say not recommended practice, far from it.
It is only you that can screw things up, Akka will not tamper with
your message in any way.
> --
>>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>>> 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+...@googlegroups.com.
> To post to this group, send email to akka...@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Jonas Bonér
Phone: +46 733 777 123
Home: http://jonasboner.com
Twitter: @jboner
Reply all
Reply to author
Forward
0 new messages