Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-02-01 Thread Alan Burlison
On 01/02/2017 10:19, Viktor Klang wrote: Try(block).fold(Status.Success(_), Status.Failure(_)) Neat, I wasn't aware of that - it appeared in 2.12: https://issues.scala-lang.org/browse/SI-8336 Ta :-) -- Alan Burlison -- -- Read the docs: http://akka.io/docs/ Check the FAQ:

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-02-01 Thread Viktor Klang
On Wed, Feb 1, 2017 at 10:51 AM, Alan Burlison wrote: > On 01/02/17 09:06, Viktor Klang wrote: > > You're welcome. A reminder that the actual error messages are very >> important to include. :) >> > > Yes, I consider my wrist to be slapped ;-) Thanks again! lol, no

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-02-01 Thread Alan Burlison
On 01/02/17 09:06, Viktor Klang wrote: You're welcome. A reminder that the actual error messages are very important to include. :) Yes, I consider my wrist to be slapped ;-) Thanks again! If there is no method in the java/scaladoc then you'll need to convert manually. If there is I

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-02-01 Thread Viktor Klang
On Wed, Feb 1, 2017 at 2:55 AM, Alan Burlison wrote: > Ahah! I think you may of nailed it... Thanks! >> > > Indeed you did nail it - "thanks" doesn't come close as I'd looked at this > for so long that I'd gone completely snow-blind ;-) > You're welcome. A reminder that

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Alan Burlison
Ahah! I think you may of nailed it... Thanks! Indeed you did nail it - "thanks" doesn't come close as I'd looked at this for so long that I'd gone completely snow-blind ;-) Is there a convenient shorthand way of mapping between a scala.util.Success and an akka.actor.Status.Success, or

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Alan Burlison
On 31/01/17 23:34, Viktor Klang wrote: I think the problem is that your responding with a scala.util.Success rather than a akka.actor.Status.Success. Ahah! I think you may of nailed it... Thanks! -- Alan Burlison -- -- Read the docs: http://akka.io/docs/ Check the FAQ:

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Viktor Klang
I think the problem is that your responding with a scala.util.Success rather than a akka.actor.Status.Success. On Wed, Feb 1, 2017 at 12:20 AM, Alan Burlison wrote: > On 31/01/17 22:18, Viktor Klang wrote: > > The answer will be in the stack traces. >> > > What I got

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Alan Burlison
On 31/01/17 22:18, Viktor Klang wrote: The answer will be in the stack traces. What I got was: java.lang.ClassCastException: Cannot cast scala.util.Success to scala.runtime.BoxedUnit which didn't give me much of a clue, however it was clear that asInstanceOf wasn't the right approach and

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Viktor Klang
The answer will be in the stack traces. -- Cheers, √ On Jan 31, 2017 10:55 PM, "Akka Team" wrote: > If it in fact was a Unit you got back from the actor then neither of the > things you tried should throw a class cast exception though. If the actor > for example sends

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Akka Team
If it in fact was a Unit you got back from the actor then neither of the things you tried should throw a class cast exception though. If the actor for example sends a Future[Unit] back, then you will have a Future[Future[Unit]] returned from ask. -- Johan Akka Team On Tue, Jan 31, 2017 at 2:41

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Alan Burlison
On 31/01/2017 20:32, Akka Team wrote: You have a Future[Something], and a Something is an Any (everything is) but it is not Unit (only Unit is), so you can not just cast it, you must replace it with an actual Unit, which is what .map(_ => ()) does. OK, thanks for confirming that I haven't

Re: [akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Akka Team
You have a Future[Something], and a Something is an Any (everything is) but it is not Unit (only Unit is), so you can not just cast it, you must replace it with an actual Unit, which is what .map(_ => ()) does. -- Johan Akka Team On Tue, Jan 31, 2017 at 11:35 AM, Alan Burlison

[akka-user] Class cast exceptions in actors that return Future[Unit]

2017-01-31 Thread Alan Burlison
I'm writing an Akka persistence journal that saves data in JSON format. I've done that as normal, by subclassing AsyncWriteJournal and implementing the necessary methods. The actual file IO is done by sub-Actors, one per output file where each persistent actor has its own JSON file. The