EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.81k stars 415 forks source link

ObjectSpace warns on remote invocation if multiple object-spaces are registered to a connection. #136

Open gretchenfrage opened 6 years ago

gretchenfrage commented 6 years ago

ObjectSpace will warn: "Ignoring remote invocation request for unknown object ID" every time it receives a remote method invocation for an object on a different object space on the same connection. (I am using multiple object spaces on the same connection because I need them to have different execution contexts.)

crykn commented 6 years ago

Did you register your object with all of your used object spaces before invoking the objects methods?

gretchenfrage commented 6 years ago

No, I only register the object on the object space it's intended to be invoked on. If I registered it with all object spaces, how would the invocation be applied on the correct object space? (If I sounds hostile, I'm not trying to)

crykn commented 6 years ago

The phrase "with all of your used object spaces" was referencing the "on a different object space on the same connection" part in your initial post. You need to register the object, which should get invoked remotely, on its local object space with an unique id: objectSpace.register(id, object). And on the other side you can get an instance of the object via the previously defined ID and the connection to the other endpoint: SomeObject object = ObjectSpace.getRemoteObject(connection, id, SomeObject.class). If you need a more in-depth example you can take a look a this one: chatrmi

NathanSweet commented 6 years ago

@gretchenfrage Please provide an executable example that shows the problem. http://sscce.org/