Java RMI : What is the role of the stub-skeleton that are generated by the rmic compiler
Asked Answered
C

1

8

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?

Capricecapricious answered 2/6, 2013 at 20:16 Comment(4)
have a look here docs.oracle.com/javase/1.5.0/docs/guide/rmi/spec/rmi-arch2.htmlLinson
Skeletons haven't been used since 1998.Soredium
@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...Apis
@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.Soredium
S
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.

Slapup answered 2/6, 2013 at 20:24 Comment(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.Soredium
@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.Manifold
@TheodoreNorvell There is a dynamically-generated stub object. You don't need to generate one any more.Soredium

© 2022 - 2024 — McMap. All rights reserved.