Closed hsestupin closed 9 years ago
Have you traced the cause of this problem? As to your general question, actor serialization is perhaps too automatic, and might justify a more fine-grained API. Can you explain your use case and why you'd want serialization within a single JVM?
Grid.getInstance("\\config\\peerNoServer.xml", "\\config\\peer1.properties").goOnline();
ActorServer actorServer = new ActorServer();
ActorClient client = new ActorClient();
client.spawn();
client.register("client");
actorServer.spawn();
actorServer.register("server");
ActorRegistry.getActor("server");
final ActorRef<Object> clientGlobal = ActorRegistry.getActor("client");
final Behavior refLocal = actorServer.ref();
clientGlobal.send(refLocal);
When there is a call ActorRegistry.getActor ("server"), in co.paralleluniverse.remote.galaxy.GlxGlobalRegistry#getActor0 exhibited AbstractCacheListener, but when I send clientGlobal.send (refLocal), the object is serialized and Kryo serialization is co.paralleluniverse.io. serialization.kryo.ReplaceableObjectKryo#writeObject which call Actor writeReplace, which creates co.paralleluniverse.remote.galaxy.GlxGlobalRemoteActor and call in construct co.paralleluniverse.remote.galaxy.GlobalRemoteChannelReceiver#getReceiver, as was previously exhibited AbstractCacheListener we get ClassCastExeption.
Ok, I tried to simplify my example as much as possible. https://github.com/hsestupin/quasar-galaxy-issue
So I've initialized FlightRecorder and we can see what happens. You can run example the same way:
gradle :issue1:run
The code in Example1 class do the following:
Actually I don't think the use-case described above is somehow undesirable for quasar-actor system, doesn't it? It seems like its pretty ok to pass actor-refs to each other.
Working on it...
Awesome, thanks
I've created a tiny project to play with - https://github.com/hsestupin/quasar-galaxy-issue You can get an issue with
Expected behaviour is throwing the following exception: java.lang.ClassCastException: co.paralleluniverse.remote.galaxy.GlxGlobalRegistry$3 cannot be cast to co.paralleluniverse.remote.galaxy.GlobalRemoteChannelReceiver
In our project we use custom high-level protocol for interaction between actors which is implemented with simple actor-message passing underneath. Our protocol assumes that serialization is always enabled. And one of the messages contains ActorRef, and this forces actor to be serialized on one local galaxy node.
So the question is should we support the case of local actors interaction or is this a quasar/galaxy issue? Thanks