Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI internals  RSS feed

 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi group,

I have recently started studying RMI using Jguru's notes and i confronted some doubts such as

1) RMI uses 2 protocols TCP/IP and a wire protocol (IIOP in java2)...i am not able to understand the exact mechanism of this stream transfer. how RMI system is configured to use both protocols at once...or there is an order like first TCP/IP then IIOP etc..

2) JDK2 uses something called REFLECTION instead of skeleton in RMI ... how this works...is it's job almost same as skeleton??

3)what exactly is the order of execution what i m writing is a mess!! but it's what i have understood.....i hope u can fix all

client program -- calls--> Interface
Interface -- calls--> Stub

Stub does packing work and sends to Transport Layer as a bit stream. From transport layer this is packed as TCP packets and then another protocol IIOP takes over (to do what??) ...okey it does what it can.....


now server accepts this request in which form ...bit stream or some kindaa packet???


>>>> okey that's all ... u might have figured how badly i am confused. i hope to get a reply soon..

also, Can u suggest me some good topics to start a project in RMI for my learning purpose?

bye
Jay
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.) IIOP is a protocol "on top of" TCP/IP - just like HTTP. Both protocols are used directly by whatever application needs them, and these protocols make calls to the TCP protocol, which makes calls to the IP protocol, and so on, through a few more levels before actually talking to hardware that sends the message across the wire. Here's a page that gives a graph of how the protocols relate.

2.) Reflection is used in a lot of cases other than RMI. In fact, you can use it yourself. Class.forName("com.whatever.MyClass").newInstance() Reflection is basically the process of getting a reference to a class and calling methods on it through the String name of the class and the String names of it's methods rather than through actual class references. It's kind of unweildly to use and slower than direct class references, so you shouldn't make it a practice to use a lot. One good case to use reflection in is when you have a known interface that you want to cast the class that you are loading through the String name to, so that you can use the direct reference through the interface. Since RMI requires you to make the Remote interface, this is a good approach. Java 1.2 did away with skeletons because they probably added in a layer to RMI somewhere to perform the functions the skeleton used to - basically this was to figure out which remote method was being called and deserializing parameters. Java 1.5 did away with stubs, too.

3.) That's pretty much what happens - but the interface doesn't call the stub - the stub implements the interface, so the interface *is* the stub. The stub produces an IIOP or JRMP packet (which uses TCP, which uses IP, etc.) The same process is performed in reverse on the server side, and the server receives the IIOP or JRMP packet.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!