Fixing ticket #519
This commit is contained in:
parent
a0cc5d3855
commit
9df923dd16
3 changed files with 35 additions and 2 deletions
|
|
@ -589,7 +589,10 @@ class RemoteServerHandler(
|
||||||
val messageReceiver = typedActor.getClass.getDeclaredMethod(typedActorInfo.getMethod, argClasses: _*)
|
val messageReceiver = typedActor.getClass.getDeclaredMethod(typedActorInfo.getMethod, argClasses: _*)
|
||||||
if (request.getOneWay) messageReceiver.invoke(typedActor, args: _*)
|
if (request.getOneWay) messageReceiver.invoke(typedActor, args: _*)
|
||||||
else {
|
else {
|
||||||
val result = messageReceiver.invoke(typedActor, args: _*)
|
val result = messageReceiver.invoke(typedActor, args: _*) match {
|
||||||
|
case f: Future[_] => f.await.result.get
|
||||||
|
case other => other
|
||||||
|
}
|
||||||
log.debug("Returning result from remote typed actor invocation [%s]", result)
|
log.debug("Returning result from remote typed actor invocation [%s]", result)
|
||||||
|
|
||||||
val messageBuilder = RemoteActorSerialization.createRemoteMessageProtocolBuilder(
|
val messageBuilder = RemoteActorSerialization.createRemoteMessageProtocolBuilder(
|
||||||
|
|
|
||||||
30
akka-remote/src/test/scala/ticket/Ticket519Spec.scala
Normal file
30
akka-remote/src/test/scala/ticket/Ticket519Spec.scala
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
|
*/
|
||||||
|
package akka.actor.ticket
|
||||||
|
|
||||||
|
import org.scalatest.Spec
|
||||||
|
import org.scalatest.matchers.ShouldMatchers
|
||||||
|
import akka.remote.{RemoteClient, RemoteServer}
|
||||||
|
import akka.actor._
|
||||||
|
|
||||||
|
|
||||||
|
class Ticket519Spec extends Spec with ShouldMatchers {
|
||||||
|
|
||||||
|
val HOSTNAME = "localhost"
|
||||||
|
val PORT = 6666
|
||||||
|
|
||||||
|
describe("A remote TypedActor") {
|
||||||
|
it("should handle remote future replies") {
|
||||||
|
import akka.remote._
|
||||||
|
|
||||||
|
val server = { val s = new RemoteServer; s.start(HOSTNAME,PORT); s}
|
||||||
|
val actor = TypedActor.newRemoteInstance(classOf[SamplePojo], classOf[SamplePojoImpl],7000,HOSTNAME,PORT)
|
||||||
|
val r = actor.someFutureString
|
||||||
|
|
||||||
|
r.await.result.get should equal ("foo")
|
||||||
|
TypedActor.stop(actor)
|
||||||
|
server.shutdown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -850,7 +850,7 @@ private[akka] abstract class ActorAspect {
|
||||||
ActorType.TypedActor)
|
ActorType.TypedActor)
|
||||||
|
|
||||||
if (isOneWay) null // for void methods
|
if (isOneWay) null // for void methods
|
||||||
//else if (TypedActor.returnsFuture_?(methodRtti)) future.get
|
else if (TypedActor.returnsFuture_?(methodRtti)) future.get
|
||||||
else {
|
else {
|
||||||
if (future.isDefined) {
|
if (future.isDefined) {
|
||||||
future.get.await
|
future.get.await
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue