However, won't it be slow if we are to copy a large object (e.g. HashMap)? 
What's the recommended way to handle such kind of large state using Akka? 
Akka Agent? STM? or I am even thinking using a separate embedded in-memory 
DB, but seems it's overkilled...
I've searched lots of places in the internet but seems nothing is found...


On Saturday, June 30, 2012 3:47:06 AM UTC+8, Antony Stubbs wrote:
>
> I suppose the other option is to create the copy when changing/setting 
> it's value, instead of when returning it. 
>
> But what about model objects? Same thing I suppose. 
>
> On 29 June 2012 14:57, Derek Williams <[email protected] <javascript:>> 
> wrote: 
> > On Fri, Jun 29, 2012 at 11:55 AM, Antony Stubbs 
> > <[email protected]<javascript:>> 
>
> > wrote: 
> >> 
> >> What's the best practice for using Agents with collections like lists 
> and 
> >> hashmaps? I.e. the complication being when you return the list, but 
> adding 
> >> an item to the list can cause a concurrent modification exception. One 
> >> possibility is instead of returning the list, return a copy. But I 
> don't 
> >> think Agent supports that as is? Same question I suppose for any type 
> that 
> >> isn't a primitive - i.e. a model object like "User". 
> > 
> > 
> > The best practice is to avoid mutable collections or other mutable 
> objects 
> > with Agents. You are probably using Java, so this might be more 
> difficult 
> > since the use of mutable objects is much more common there. 
> > 
> > It might be possible for Akka to support a custom method for modifying 
> the 
> > value before returning it? It's been a while since I've looked at the 
> Agent 
> > code. 
> > 
> > -- 
> > Derek Williams 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Akka User List" group. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> > [email protected] <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/akka-user?hl=en. 
>

-- 
>>>>>>>>>>      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 [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/groups/opt_out.

Reply via email to