RemoteActorRef serializtion

13 views
Skip to first unread message

kerzol

unread,
Oct 6, 2010, 12:07:52 PM10/6/10
to Akka User List
Hello everyone!

I tried to serialize RemoteActorRef:

var ref = RemoteClient.actorFor("A", "localhost", 9999)
anotherActorRef !
RemoteActorSerialization.toRemoteActorRefProtocol(ref)

But the RemoteActorSerialization.toRemoteActorRefProtocol throwed a
exception:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org_scala_tools_maven_executions.MainHelper.runMain(MainHelper.java:
151)
at
org_scala_tools_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:
26)
Caused by: java.lang.UnsupportedOperationException: Not supported for
RemoteActorRef
at
se.scalablesolutions.akka.actor.RemoteActorRef.unsupported(ActorRef.scala:
1336)
at
se.scalablesolutions.akka.actor.RemoteActorRef.actorClass(ActorRef.scala:
1304)
at se.scalablesolutions.akka.actor.RemoteActorSerialization
$.toRemoteActorRefProtocol(SerializationProtocol.scala:206)
at Start$.main(L.scala:36)
at Start.main(L.scala)
... 6 more


So, I wrote a small patch which fixes this problem:

#### BEGIN ####
diff --git a/akka-core/src/main/scala/actor/
SerializationProtocol.scala b/akka-core/src/main/scala/actor/
SerializationProtocol.scala
index 20e9842..a4dffd1 100644
--- a/akka-core/src/main/scala/actor/SerializationProtocol.scala
+++ b/akka-core/src/main/scala/actor/SerializationProtocol.scala
@@ -203,7 +203,7 @@ object RemoteActorSerialization {
val port = homeAddress.getPort

if (!registeredInRemoteNodeDuringSerialization) {
- Actor.log.debug("Register serialized Actor [%s] as remote @ [%s:
%s]", actorClass.getName, host, port)
+ Actor.log.debug("Register serialized Actor [%s] as remote @ [%s:
%s]", actorClassName, host, port)
RemoteServer.getOrCreateServer(homeAddress)
RemoteServer.registerActor(homeAddress, uuid, ar)
registeredInRemoteNodeDuringSerialization = true
@@ -211,7 +211,7 @@ object RemoteActorSerialization {

RemoteActorRefProtocol.newBuilder
.setUuid(uuid)
- .setActorClassname(actorClass.getName)
+ .setActorClassname(actorClassName)
.setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build)
.setTimeout(timeout)
.build
#### END ####

It's a real bug? Or I'm just misunderstanding?
Tell me more, please.

√iktor Klang

unread,
Oct 7, 2010, 7:43:48 AM10/7/10
to akka...@googlegroups.com
Hey Kerzol,

please check the current master if your problem has been resolved.

Cheers,


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang,
Code Connoisseur
Work:   www.akkasource.com
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

kerzol

unread,
Oct 8, 2010, 10:10:51 AM10/8/10
to Akka User List


On 7 oct, 13:43, √iktor Klang <viktor.kl...@gmail.com> wrote:
> Hey Kerzol,
>
> please check the current master if your problem has been resolved.
>
> Cheers,

No, it produces exception:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org_scala_tools_maven_executions.MainHelper.runMain(MainHelper.java:
151)
at
org_scala_tools_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:
26)
Caused by: java.lang.UnsupportedOperationException: Not supported for
RemoteActorRef
at
se.scalablesolutions.akka.actor.RemoteActorRef.unsupported(ActorRef.scala:
1419)
at
se.scalablesolutions.akka.actor.RemoteActorRef.actorClass(ActorRef.scala:
1389)
at se.scalablesolutions.akka.serialization.RemoteActorSerialization
$.toRemoteActorRefProtocol(SerializationProtocol.scala:246)
at Start$.main(L.scala:36)
at Start.main(L.scala)

My code was tested with following commit:

commit d165f1472039bfb2b38c0fd99baad6ee24d91e36
Merge: 848a69d e809d98
Author: Viktor Klang <viktor...@gmail.com>
Date: Fri Oct 8 14:59:56 2010 +0200

√iktor Klang

unread,
Oct 8, 2010, 10:32:38 AM10/8/10
to akka...@googlegroups.com
On Fri, Oct 8, 2010 at 4:10 PM, kerzol <kerzo...@gmail.com> wrote:


On 7 oct, 13:43, √iktor Klang <viktor.kl...@gmail.com> wrote:
> Hey Kerzol,
>
> please check the current master if your problem has been resolved.
>
> Cheers,

No, it produces exception:

Alright, should be fixed now, and pushed to master.

 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Reply all
Reply to author
Forward
0 new messages