| Author |
Using Sockets to pass an RMI Reference
|
P Reen
Greenhorn
Joined: Jun 17, 2005
Posts: 2
|
|
Hi, I have 2 processes A and B. Both already communicate via Sockets. I need B to use a callback on an object in A. This is an RMI Object. When I pass the Reference to the RMI object in a serialized Object to B, B involkes the callback method. However The callback is executed on B. i.e. It looks like the Remote RMI Object is serialized accross to B and B then involkes the method on the newly created RMI object living in its process. I have tried passing Interface refs, Object Refs and RemoteRefs but to no avail. I can't see the issue as I thought java will not serialize any object which extends remote. Any ideas Thanks
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
|
Can you post some code so that we know what we are talking about?
|
 |
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
|
|
|
You cannot send a remote object reference over the wire and call it. That's not how it works. There is a Remote interface. Your remote interface extends that. Your remote class impelements the interface. You must then deploy your remote interface to an RMI server to indicate where the actual remote object lives. The client (e.g., socket B) does a lookup in the registry and gets an instance of the remote proxy that implements the remote interface. The proxy calls are marshalled over the wire to the actual object on the remote server.
|
 |
 |
|
|
subject: Using Sockets to pass an RMI Reference
|
|
|