Hi,self is val,and never change,and the sender() is based on the context which is got from the ThreadLocal. if you want to replay to the original sender when the task is done,you should not use the sender() method call in the closure , you should use
val replayTo = sender() and passing the replayTo to the closing block,passing self is fine~:P 在 2014年11月9日星期日UTC+8上午2时32分54秒,Jestan Nirojan写道: > > I have a question about passing self actor ref to different thread / > future. > > Closing over sender could return a null or be the wrong ActorRef. > Likewise closing over self reference in a future will result similar > outcome? > > I am seeing wired outputs like, future sends response to wrong actor / > actor receiving duplicate responses. > -- >>>>>>>>>> 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.
