Sunday, 15 May 2011

scala - akka onComplete doesnt seem to work. java.lang.ClassCastException when trying to cast -



scala - akka onComplete doesnt seem to work. java.lang.ClassCastException when trying to cast -

i seek inquire actor , stuff afterwards "oncomplete".

here example:

(this snippet contained in method)

(receivingactor ? message).mapto[returnmessage].oncomplete { case success(rm) => rm.geteitherobjectorerror() match { case left(a) => homecoming case right(e) => sender ! returnmessage(none, some(e)) context.stop(self) } case failure ... (doesnt matter) }

when seek cast object expected type...

any.asinstanceof[expectedtype]

... receive next exception:

error akka.actor.oneforonestrategy - scala.runtime.boxedunit cannot cast expectedtype java.lang.classcastexception: scala.runtime.boxedunit cannot cast expectedtype

usually i`d expect object of type "any", so... missing?

thanks in advance

future.oncomplete has homecoming type of unit, doesn't homecoming anything.

scala casting akka classcastexception

No comments:

Post a Comment