diff --git a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala index 621dc25c18..8e9f8c95ad 100644 --- a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala +++ b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala @@ -842,7 +842,6 @@ class RemoteServerHandler( } override def channelDisconnected(ctx: ChannelHandlerContext, event: ChannelStateEvent) = { - import scala.collection.JavaConversions.asScalaIterable val clientAddress = getClientAddress(ctx) // stop all session actors @@ -956,6 +955,14 @@ class RemoteServerHandler( private def dispatchToTypedActor(request: RemoteMessageProtocol, channel: Channel) = { val actorInfo = request.getActorInfo val typedActorInfo = actorInfo.getTypedActorInfo + /* TODO Implement sender references for remote TypedActor calls + if (request.hasSender) { + val iface = //TODO extrace the senderProxy interface from the request, load it as a class using the application loader + val ref = RemoteActorSerialization.fromProtobufToRemoteActorRef(request.getSender, applicationLoader) + val senderTA = TypedActor.createProxyForRemoteActorRef[AnyRef](iface, ref) + Some() + } else None + */ val typedActor = createTypedActor(actorInfo, channel) //FIXME: Add ownerTypeHint and parameter types to the TypedActorInfo? @@ -996,7 +1003,8 @@ class RemoteServerHandler( try { val messageReceiver = resolveMethod(typedActor.getClass, ownerTypeHint, typedActorInfo.getMethod, argClasses) - + //TODO SenderContextInfo.senderActorRef.value = sender + //TODO SenderContextInfo.senderProxy.value = senderProxy if (request.getOneWay) messageReceiver.invoke(typedActor, args: _*) //FIXME execute in non-IO thread else { //Sends the response @@ -1022,21 +1030,23 @@ class RemoteServerHandler( server.notifyListeners(RemoteServerError(e, server)) } - messageReceiver.invoke(typedActor, args: _*) match { //FIXME execute in non-IO thread + messageReceiver.invoke(typedActor, args: _*) match { //TODO execute in non-IO thread //If it's a future, we can lift on that to defer the send to when the future is completed case f: Future[_] => f.onComplete( future => sendResponse(future.value.get) ) case other => sendResponse(Right(other)) } } } catch { - case e: InvocationTargetException => - EventHandler.error(e, this, e.getMessage) - write(channel, createErrorReplyMessage(e.getCause, request, AkkaActorType.TypedActor)) - server.notifyListeners(RemoteServerError(e, server)) case e: Exception => EventHandler.error(e, this, e.getMessage) - write(channel, createErrorReplyMessage(e, request, AkkaActorType.TypedActor)) + write(channel, createErrorReplyMessage(e match { + case e: InvocationTargetException => e.getCause + case e => e + }, request, AkkaActorType.TypedActor)) server.notifyListeners(RemoteServerError(e, server)) + } finally { + //TODO SenderContextInfo.senderActorRef.value = None ? + //TODO SenderContextInfo.senderProxy.value = None ? } } diff --git a/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala b/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala index 3db2288e8f..3601fd6368 100644 --- a/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala +++ b/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala @@ -846,19 +846,19 @@ private[akka] abstract class ActorAspect { case -1 => s case x => s.substring(0,x + TypedActor.AW_PROXY_PREFIX.length) } - //FIXME: Add ownerTypeHint and parameter types to the TypedActorInfo? + //TODO: Add ownerTypeHint and parameter types to the TypedActorInfo? val message: Tuple3[String, Array[Class[_]], Array[AnyRef]] = ((extractOwnerTypeHint(methodRtti.getMethod.getDeclaringClass.getName), methodRtti.getParameterTypes, methodRtti.getParameterValues)) - //FIXME send the interface name of the senderProxy in the TypedActorContext and assemble a context.sender with that interface on the server + //TODO send the interface name of the senderProxy in the TypedActorContext and assemble a context.sender with that interface on the server //val senderProxy = Option(SenderContextInfo.senderProxy.value) val future = Actor.remote.send[AnyRef]( message, senderActorRef, None, remoteAddress.get, timeout, isOneWay, actorRef, - Some((interfaceClass.getName, methodRtti.getMethod.getName)), + Some((interfaceClass.getName, methodRtti.getMethod.getName)), //TODO Include the interface of the senderProxy here somehow ActorType.TypedActor, None) //TODO: REVISIT: Use another classloader?