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