By "processes the messages one by one", do you mean My message B has to be 
wait until message A gets processed?

They can't be executed in parallel?


Thanks

Leon


在 2014年5月14日星期三UTC-7下午10时34分45秒,Konrad Malawski写道:
>
> Actors are thread safe inside them "by definition".
> The actor has one mailbox and processes the messages one by one from it. 
> We guarantee that fields are properly visible, even if the actor jumps 
> around threads - no need for CHM in the actor
>
>
> On Thu, May 15, 2014 at 7:31 AM, Leon Ma <[email protected] 
> <javascript:>>wrote:
>
>> Hi,
>>
>> Assuming I have an actor which hold a map M
>>
>> And I will possibly do:
>>
>> 1, send message A to the actor
>> 2. send message B to the actor
>>
>>
>> When receiving messages,  A will possibly be executed in thread 1 and B 
>> will possibly be executed in thread 2.
>> Although A is triggered earlier than B ( sequence delivery is for sure), 
>> but B might be finished executing prior to A, right?
>>
>>
>> Assuming in the receive method, I'll try to do something like "find an 
>> entry from the map M, if not exist, then create one".
>>
>> Will I see any possible concurrent issues? should I use a thread safe map 
>> impl like TrieMap or ConcurrentHashMap to make sure the put operation is 
>> atomic like putIfAbsent?
>>
>>
>>
>> Thanks
>>
>> Leon
>>
>>
>>
>>
>>  -- 
>> >>>>>>>>>> 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,
> Konrad 'ktoso' Malawski
> hAkker - Typesafe, Inc
>
> <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].
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