I've an actor where I want to store my mutable state inside a map.

Clients can send Get(key:String) and Put(key:String,value:String) messages 
to this actor. 

I'm considering the following options. 

1. Don't use futures inside the Actor's receive method. In this may have a 
negative impact on both latency as well as throughput in case I've a large 
number of gets/puts. because both will be performed in sequence. 
2. Use java.util.concurrent.ConcurrentHashMap and then invoke the gets and 
puts inside a Future. 


Given that java.util.concurrent.ConcurrentHashMap is thread-safe, I was 
wondering if it is still a problem to close over the concurrentHashMap 
inside a Future created for each put and get. 

PS: I'm aware of the fact that it's a really bad idea to close over mutable 
state inside  a Future inside an Actor but I'm still interested to know if 
in this particular case it is correct or not? 




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