• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

UnicastRemoteObject

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am confused about the RMI UnicastRemoteObject,
I know a client can look up a server which create a object whose class extends remote, the object then casted to a remote interface and passed back to the client, then client was able to manipulate the remote interface.
Why there is a need to let the object's class extends
UnicastRemoteObject, without extending the UnicastRemoteObject, it seems to work anyway.
public class A implements IA(RemoteInterface)
{extends UnitcastRemoteObject} *******What do we gain by adding this line.
Server B {
main() {
x= new A();
return (IA) x;
}
}

Thx
Pat
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no need to extend UnicastRemoteObject, actually. What you do need is to be able to export the object in question, which can be satisfied with the static call UnicastRemoteObject.exportObject(). Without that piece, the object itself would not bind as necessary to the registry server.
It is possible to make things work without doing this, but only if the client and server code are on the same machine and able to see the same classpath.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
reply
    Bookmark Topic Watch Topic
  • New Topic