2

My client uses RMI to connect to a service on a different host.

This client calls a method on the service that returns a remote object reference. Can the client pass the associated stub to a different method of the service in a way that is transparent to the service?

In other words, can the client use the stub to call a method of the service, so that the service sees the original object and not the stub?

High level example: (client code)

// Connecting to the service.
Service service = (Service) Naming.lookup(servicename);

// Retrieving intermediate result. (Passed as remote object reference.) 
IntermediateResult res = service.getIntermediateResult();

// Passing stub result back to service...
service.confirmResult(res);

I would expect RMI to resolve the reference/proxy so that Service sees the object it originally sent, but this doesn't appear to be the case. Instead, the above code just sends the proxy to the service:

Proxy[IntermediateResult,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[10.43.89.166:58799](remote),objID:[-762db624:148f519cb69:-7fec, -4488749599514745712]]]]]

1
  • Why don't you return a serialized value object instead of a proxy in the intermediate result? Commented Oct 9, 2014 at 21:32

1 Answer 1

1

No. The remote object gets serialized as its stub, but the reverse doesn't happen. You would need to maintain your own Map for this purpose.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.