Do you mean literally calling "sleep()"?  You should never, ever call
Thread.sleep() inside an Actor, and you shouldn't need to -- at worst, you
have the Actor use become() and stash() to store up messages until you get
the response you need; once you have all the needed information, you
process that, unstash() and become() back to the normal state.

Basically, blocking is always a bad idea inside Actors (for exactly the
reasons you suggest), and except for when interfacing to external libraries
it is basically never necessary.  Always figure that there is a
non-blocking way to deal with the problem.  stash() and become() are
usually your friend in such situations...

On Sun, Feb 19, 2017 at 1:05 PM, scala solist <scalasol...@gmail.com> wrote:

> I need to perform number of requests to different actors and sum them to
> some response. An actor wrap all requests inside futures and compose them
> to single. After that I suppose actor would be put in sleep until it
> recovers all needed information (or timer runs out). What if I had hundreds
> of such actors simultaneously?
>
> Naive approach is that they all would be put to sleep and would exhaust
> thread pool which leads to deadlock possibility. Does akka uses such naive
> approach or it has some tricky magic to return blocked actor thread back to
> executor? Should I avoid awaiting inside actors?
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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