`import context.dispatcher` is what „everybody“ is doing, not? I’m using it all 
over the place, because I have learned that one can import from stable 
identifiers (e.g. vals) in Scala. Hence I don’t think changing the docs has the 
necessary effect.

How can a final val be „nulled"? Unsafe? Reflection?

Cheers
Heiko

--

Heiko Seeberger
Home: heikoseeberger.de
Twitter: @hseeberger
Public key: keybase.io/hseeberger




> Am 07.03.2018 um 19:23 schrieb Patrik Nordwall <patrik.nordw...@gmail.com>:
> 
> Thanks!
> 
> On Wed, Mar 7, 2018 at 6:16 PM, Jeff <jknight12...@gmail.com 
> <mailto:jknight12...@gmail.com>> wrote:
> An example of documentation for using import context.dispatcher is here 
> https://doc.akka.io/docs/akka/2.5/futures.html#within-actors 
> <https://doc.akka.io/docs/akka/2.5/futures.html#within-actors>
> 
> I can create some PR to update the documentation
> 
> On Wednesday, March 7, 2018 at 6:09:24 AM UTC-8, Patrik Nordwall wrote:
> It's because when the actor is stopped some of the fields are cleared (yeah, 
> even though they are vals) to "help" the GC in case something (e.g. an local 
> ActorRef) is still referencing the actor instance.
> 
> implicit val ec = context.dispatcher
> 
> would solve it here.
> 
> Where in the documentation is the import recommended? We should probably 
> update that. Would you be able creating a PR fixing it? Thanks.
> 
> /Patrik
> 
> On Tue, Mar 6, 2018 at 10:44 PM, Jeff <jknigh...@gmail.com <>> wrote:
> I suspected as much. So what would you suggest as for handling use cases 
> where you could have chained flatmaps on futures that at the end will pipeTo 
> a message back to the actor. Should we set the ExecutionContext to a val? 
> 
> On Tuesday, March 6, 2018 at 12:09:22 PM UTC-8, √ wrote:
> Context is bound to the lifecycle of the actor.
> 
> On Tue, Mar 6, 2018 at 8:37 PM, Jeff <jknigh...@gmail.com <>> wrote:
> I have noticed an issue where if a future maps/flatmaps after actor shutdown, 
> a NullPointerException is thrown. I've narrowed it down to the import 
> context.dispatcher, which I technically understand since that is closing over 
> actor state. If I change that to implicit val ec = context.dispatcher, 
> everything works fine. 
> 
> I'd like to understand what is the best practice in this case, since the 
> documentation for context.dispatcher indicates that it is threadsafe and 
> looking at the actor trait, context is a val. Most documentation seems to 
> indicate that import context.dispatcher is preferred. 
> 
> Thanks
> Jeff
> 
> -- 
> >>>>>>>>>> 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+...@googlegroups.com <>.
> To post to this group, send email to akka...@googlegroups.com <>.
> 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>.
> 
> 
> 
> -- 
> Cheers,
> √
> 
> -- 
> >>>>>>>>>> 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+...@googlegroups.com <>.
> To post to this group, send email to akka...@googlegroups.com <>.
> 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>.
> 
> 
> 
> -- 
> 
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
> 
> 
> 
> -- 
> >>>>>>>>>> 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 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>.
> 
> 
> 
> -- 
> 
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
> 
> 
> 
> -- 
> >>>>>>>>>> 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 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 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