[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

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

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

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?

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,

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

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

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

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,

[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 =