The simple and direct answer is that none of the methods are allowed to be 
called from an asynchronous context.

Regards,

Roland

> 21 sep 2015 kl. 15:18 skrev John Ulric <uja...@gmail.com>:
> 
> Hi all, I create a Future in an actor's onReceive method, and use onComplete 
> to trigger a side-effect when that future completes, like this:
> 
> public void onReceive(Object message) throws Exception {
>     final ActorRef sender = sender();
>     Future f = ...;
>     f.onComplete(new OnComplete() {
>         @Override
>         public void onComplete(Throwable throwable, Object object) throws 
> Throwable {
>             // Can use final sender here.
>             // What actor methods are allowed here?
>         }
>     }, context().dispatcher());
> }
> 
> It's clear that one must not modify the actor's state from within the 
> onComplete callback, and it's clear that one must use the self() and sender() 
> methods outside the callback and pass it into the onComplete as finals. But 
> what other actor methods are allowed inside the onComplete method? Is it ok 
> to use context(), eg?
> 
> Thanks.
> 
> -- 
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com 
> <mailto:akka-user+unsubscr...@googlegroups.com>.
> To post to this group, send email to akka-user@googlegroups.com 
> <mailto:akka-user@googlegroups.com>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
twitter: @rolandkuhn
 <http://twitter.com/#!/rolandkuhn>

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

Reply via email to