There might be some miscommunication here: as I understand it the OP is using 
Await.result on an aggregation future. To that the answer is: don’t do that! 
The JVM does not support suspending an active computation to free up the 
thread, so you’re right that doing this can lead to deadlock. There are two 
solutions: the pipeTo pattern, or not using Futures at all and collecting the 
responses within a dedicated ephemeral actor.

Regards,

Roland

> 19 feb. 2017 kl. 22:15 skrev Rafał Krzewski <[email protected]>:
> 
> The actor itself is the place where state should be held. If the actor 
> "should not be bothered" by the dispatcher until a specific condition occurs, 
> just stash the incoming messages for processing later. ActorContext.become 
> lets you switch behaviors, for example available / unavailable state. When 
> entering available state, you just unstash the postponed messages.
> 
> As Justin said, all the pieces needed to implement the usecase you describe 
> are already there, and no sleeping or blocking is necessary.
> 
> I wouldn't say that Akka is complicated at the conceptual level. Quite the 
> contrary: in my opinion it is remarkably simple and elegant. It is very 
> different from typical JVM threads and locks concurrency, so it might be hard 
> to wrap your head around at first.
> 
> Cheers,
> Rafał
> 
> W dniu niedziela, 19 lutego 2017 21:30:19 UTC+1 użytkownik scala solist 
> napisał:
> 
> On Sunday, February 19, 2017 at 10:53:01 PM UTC+3, Justin du coeur wrote:
> Do you mean literally calling "sleep()"?  
> 
> I mean sleep as a thread state. Alternative is to save actor state somehow 
> and return thread to dispatcher so it can be reused. The dispatcher should 
> never bother the actor until it become available. It complicates things for 
> the actor system, but Akka is already very complicated and I'm not sure if it 
> is already implemented somewhere 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/akka-user 
> <https://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to