9

I am currently learning Java RMI (Remote Method Invocation), and I followed the tutorial provided by Oracle on it´s website. I have a particular question however:

What is the use of the stub-skeleton generated by rmic? Do I really need it?

Ollu_
  • 101
  • 1
  • 10
user2435860
  • 778
  • 3
  • 9
  • 22
  • have a look here http://docs.oracle.com/javase/1.5.0/docs/guide/rmi/spec/rmi-arch2.html – BeNdErR Jun 02 '13 at 20:23
  • Skeletons haven't been used since 1998. – user207421 Jun 02 '13 at 22:55
  • 1
    @EJP-SIR,I have seen dozens of your answers related to tag `rmi` on stack-overflow. They are the best ones seriously as compared to other official tutorials. Do you have any personal blogs related to rmi.Please,I need them! THANKS... – Am_I_Helpful Oct 22 '14 at 08:41
  • @shekarsuman Thanks. I don't do blogs, only my book ;-) *java.rmi: The Guide to Remote Method Invocation in Java,* Pitt & McNiff, Addison Wesley 2001. – user207421 Oct 29 '14 at 04:40

1 Answers1

13

The Stub/Skeleton hides the communication details away from the developer. The Stub is the class that implements the remote interface. It serves as a client-side placeholder for the remote object. The stub communicates with the server-side skeleton. The skeleton is the stub's counterpart on server-side. Both communicate via the network. The skeleton actually knows the real remote objects delegates the stub's request to it and returns the response to the stub. You require both as they are the essential building blocks for RMI.

Stanko
  • 4,275
  • 3
  • 23
  • 51
Thomas
  • 1,302
  • 9
  • 16
  • 3
    You don't require both. You haven't needed a skeleton since 1998, and you don't need a stub either if you follow what it says in the preamble Javadoc to `UnicastRemoteObject`. – user207421 Oct 29 '14 at 04:44
  • 1
    @EJP I think that behind the scenes there are stub objects, even if you use `UnicastRemoteObject`. After all some object will be created on the client machine to represent the remote object; that object is a proxy and I think can be called a stub. It certainly fills the role that the instances of the old stub classes filled. – Theodore Norvell Mar 10 '15 at 04:58
  • 1
    @TheodoreNorvell There is a *dynamically-generated* stub object. You don't need to *generate* one any more. – user207421 Apr 13 '17 at 03:07