[akka-user][deprecated] Re: [akka-user] import context.dispatcher nullpointerexception

2018-05-02 Thread Patrik Nordwall
For the record, I created issue https://github.com/akka/akka/issues/25040

On Thu, Mar 8, 2018 at 9:15 PM, Jeff  wrote:

> I agree with Heiko on this one - import context.dispatcher is used
> everywhere. It is mentioned in the docs not to close over 'context' and
> access it outside of message handlers, however I think more education is
> needed here.
>
> On Wednesday, March 7, 2018 at 5:35:05 PM UTC-8, Konrad Malawski wrote:
>>
>> Yes it is nulled using unsafe.
>>
>> --
>> Cheers,
>> Konrad 'ktoso ' Malawski
>> Akka  @ Lightbend 
>>
>> On March 8, 2018 at 7:32:56, Heiko Seeberger (loe...@posteo.de) wrote:
>>
>> `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 :
>>
>> Thanks!
>>
>> On Wed, Mar 7, 2018 at 6:16 PM, Jeff  wrote:
>>
>>> An example of documentation for using import context.dispatcher is here
>>> 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  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  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/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >> Search the archives: https://groups.google.com/grou
>>> p/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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/additional/faq.html
> >> Search the archives: https://groups.google.com/grou
> p/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.
> For more options, visit https://groups.google.com/d/optout.
>



 --

 Patrik Nordwall
 Akka Tech Lead
 Lightbend  -  Reactive apps on the JVM
 Twitter: @patriknw


>>> --
>>> >> Read the docs: http://akka.io/docs/
>>>

Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-08 Thread Jeff
I agree with Heiko on this one - import context.dispatcher is used 
everywhere. It is mentioned in the docs not to close over 'context' and 
access it outside of message handlers, however I think more education is 
needed here. 

On Wednesday, March 7, 2018 at 5:35:05 PM UTC-8, Konrad Malawski wrote:
>
> Yes it is nulled using unsafe.
>
> -- 
> Cheers,
> Konrad 'ktoso ' Malawski
> Akka  @ Lightbend 
>
> On March 8, 2018 at 7:32:56, Heiko Seeberger (loe...@posteo.de 
> ) wrote:
>
> `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  >:
>
> Thanks!
>
> On Wed, Mar 7, 2018 at 6:16 PM, Jeff > 
> wrote:
>
>> An example of documentation for using import context.dispatcher is here 
>> 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  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  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/
>> >> 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+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Cheers,
> √
>

 --
 >> 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+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.
 Visit this group at https://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> --
>>>
>>> Patrik Nordwall
>>> Akka Tech Lead
>>> Lightbend  -  Reactive apps on the JVM
>>> Twitter: @patriknw
>>>
>>>
>> --
>> >> 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 subscrib

Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-07 Thread Konrad “ktoso” Malawski
Yes it is nulled using unsafe.

-- 
Cheers,
Konrad 'ktoso ' Malawski
Akka  @ Lightbend 

On March 8, 2018 at 7:32:56, Heiko Seeberger (loe...@posteo.de) wrote:

`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 :

Thanks!

On Wed, Mar 7, 2018 at 6:16 PM, Jeff  wrote:

> An example of documentation for using import context.dispatcher is here
> 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  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  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/
> >> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/additional/faq.html
> >> Search the archives: https://groups.google.com/grou
> p/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.
> For more options, visit https://groups.google.com/d/optout.
>



 --
 Cheers,
 √

>>>
>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >> Search the archives: https://groups.google.com/grou
>>> p/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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Patrik Nordwall
>> Akka Tech Lead
>> Lightbend  -  Reactive apps on the JVM
>> Twitter: @patriknw
>>
>>
> --
> >> 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.
>



--

Patrik Nordwall
Akka Tech Lead
Lightbend  -  Reactive apps on the JVM
Twitter: @patriknw


--
>> Read

Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-07 Thread Heiko Seeberger
`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 :
> 
> Thanks!
> 
> On Wed, Mar 7, 2018 at 6:16 PM, Jeff  > wrote:
> An example of documentation for using import context.dispatcher is here 
> 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 > 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 > 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/ 
> >> 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+...@googlegroups.com <>.
> To post to this group, send email to akka...@googlegroups.com <>.
> Visit this group at https://groups.google.com/group/akka-user 
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> 
> 
> -- 
> Cheers,
> √
> 
> -- 
> >> 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+...@googlegroups.com <>.
> To post to this group, send email to akka...@googlegroups.com <>.
> Visit this group at https://groups.google.com/group/akka-user 
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> 
> 
> -- 
> 
> Patrik Nordwall
> Akka Tech Lead
> Lightbend  -  Reactive apps on the JVM
> Twitter: @patriknw
> 
> 
> 
> -- 
> >> 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 

Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-07 Thread Patrik Nordwall
Thanks!

On Wed, Mar 7, 2018 at 6:16 PM, Jeff  wrote:

> An example of documentation for using import context.dispatcher is here
> 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  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  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/
> >> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/additional/faq.html
> >> Search the archives: https://groups.google.com/grou
> p/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.
> For more options, visit https://groups.google.com/d/optout.
>



 --
 Cheers,
 √

>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >> Search the archives: https://groups.google.com/grou
>>> p/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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Patrik Nordwall
>> Akka Tech Lead
>> Lightbend  -  Reactive apps on the JVM
>> Twitter: @patriknw
>>
>> --
> >> 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.
>



-- 

Patrik Nordwall
Akka Tech Lead
Lightbend  -  Reactive apps on the JVM
Twitter: @patriknw

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


Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-07 Thread Jeff
An example of documentation for using import context.dispatcher is 
here 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 > 
> 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  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/
 >> 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+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.
 Visit this group at https://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> Cheers,
>>> √
>>>
>> -- 
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Akka Tech Lead
> Lightbend  -  Reactive apps on the JVM
> Twitter: @patriknw
>
>

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


Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-07 Thread Patrik Nordwall
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  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  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/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >> Search the archives: https://groups.google.com/grou
>>> p/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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
> --
> >> 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.
>



-- 

Patrik Nordwall
Akka Tech Lead
Lightbend  -  Reactive apps on the JVM
Twitter: @patriknw

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


Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-06 Thread Jeff
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 > 
> 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/
>> >> 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+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> √
>

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


Re: [akka-user] import context.dispatcher nullpointerexception

2018-03-06 Thread Viktor Klang
Context is bound to the lifecycle of the actor.

On Tue, Mar 6, 2018 at 8:37 PM, Jeff  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/
> >> 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.
>



-- 
Cheers,
√

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


[akka-user] import context.dispatcher nullpointerexception

2018-03-06 Thread Jeff
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/
>>  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.