Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

About extending UnicastRemoteObject!!!  RSS feed

 
Ramalingam Vijayakumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Why do we say extends UnicastRemoteObject in RMI...
I have done a RMI program without extending this class...it works perfectly.
**** What is the significance of extending this UnicastRemoteObject class..
please do reply me as soon as possible...
many thanks,
ram...
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extending UnicastRemoteObject is not a requirement; it's just ensures that your subclass will be exported once constructed. You could just as easily code it this way:

Or for that matter, you could call exportObject() in a main().
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Ramalingam Vijayakumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Micheal,
Thanks a lot for your reply..I never knew that something like this can be done...
What I have done in my program is
class XYZ implements RemoteSeriveInterface,Serializable {
public void serviceName() throws RemoteException { }

}
and when I register the object of the above code it registers perfectly..and it also serves as a remote object...What I am not getting till now is what is the significance of using UnicastRemoteObject ...
thanks,
ram...
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Ram,
Are you telling me that , without using UnicastRemoteObject.exportObject(obj), you were able to bind your
object in the registry?From your words i get an impression that
you are not using UnicastRemoteObject anywhere in your program!!
I guess that is not possible!!

Manjunath
 
Ramalingam Vijayakumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello manjunath,
I have a problem in my m/c...
when I workked with an simple RMI prog...without using UnicastRemoteObject it get's registerd with the registry [perfectly..but when I make a remote call ...it is not executing in servers m/c but instead it make a copy of the remote object and the the invocation happens only in that copy...
I do not understnad whether it is my m'c problem or not..
When I tried in some other m/c it didnt work..It throwed a exception and the time of runing the server..
anyway thanx for your reply..
bye,
ram..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!