• Post Reply Bookmark Topic Watch Topic
  • New Topic

UniCastRemoteObject

 
megha ghanekar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone!!!
I have a confusion regarding UnicastRemoteOnject.
We have to write 3 files for rmi Application as follows:

1. Remote Interface
2. Remote Implementation class
3. Remote Registerer or Server class

Remote Implementation class implements Remote Interface. But alongwith that should it extend UnicastRemoteObject. or registerer class should extend the UnicastRemoteObject.
So ie it necessary that to make the object as remote object i should make the implementation class extend UnicastRemoteObject. Or to be a remote server i should make the registerer/server class extend UnicastRemoteObject.
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not extend URO. You export your impl class using that method in your server:
UnicastRemoteObject.exportObject(impl));
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either:

Have your remote implementation extend UnicastRemoteObject.

or

Use the UnicastRemoteObject.exportObject(impl) method.


The first approach is usually seen as "easier", and usually given in examples (though I'm not really sure why) whereas the second approach is usually better, because it uses delegation rather than uneeded subclassing.
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RemoteObject, class that provides a correct implemetation of hashCode, equals, and toString, for remote environments.

RemoteServer extends RemoteObject adding logging issues and getClientHost method that returns a string representation of the client host for the remote method invocation being processed in the current thread.
UnicastRemoteObject extends RemoteServer and its instances are automatically exported in construction:


Either ways are possible, for common usage, just have in mind the differences.

Regards
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!