what is stub on the "server" and what does skeleton mean?
Solution 1
look at the followed picture:
To be short,stub and skeleton are counterparts in a web service setup. Skeleton belongs to service provider side
and stub belongs to receiver side
. At lower level stub and skeleton communicate with each other.
From client side the business objects communicates with stub objects and stub takes the responsibility form the message and invoke the web service. Once the invoking is done, at service provider side, skeleton is the parallel object for stub and it receives the request message and understands it and passes on the information to service side business objects.
Solution 2
Stub and skeleton both hide some complexity.
The stub hides the serialization of parameters and the network-level communication in order to present a simple invocation mechanism to the caller.
The skeleton is responsible for dispatching the call to the actual remote object implementation.
http://docs.oracle.com/javase/7/docs/platform/rmi/spec/rmi-arch2.html
http://www-itec.uni-klu.ac.at/~harald/ds2001/rmi/rmi.html
Solution 3
The first thing you need to do is forget about skeletons. They have been obsolete since 1998.
The stub is created by the remote object when it is exported. It is then either bound to the Registry and obtained by the client via a lookup, or else it is returned directly to the client as a result of another remote method.
The client then uses the stub as an implementation of the remote interface concerned, to perform the networking part of RMI, interacting with the server JVM to eventually invoke the same method in the remote object that the client is invoking in the stub.
Solution 4
The key to understanding "stubs" and "skeletons" is to understand the concept of marshalling:
The rmiregistry is just a lookup facility; nothing more. When a server does a bind()
, it "registers" itself with the rmiregistry. When a client does a lookup()
, he checks what's registered on the server. Nothing more, nothing less.
I don't think it makes sense to quibble about terminology like "skeletons". If you prefer, you can call everything a "stub". The point is, both are PROXIES, both do MARSHALLING, one side exists under the client (that the client calls into), and the other side exists on the server (the skeleton calls into the actual server code).
Hopefully, my explanation and example helped in your another link helped (at least a little).
Solution 5
Stub
A stub for a remote object acts as a client's local representative or proxy for the remote object. The stub hides the serialization of parameters and the network-level communication in order to present a simple invocation mechanism to the caller.
Alternatively, consider a program running on one machine: each method is a branch. When you move the method to a remote machine, you cut off the branch, leaving a stub which contains only communications.
Source
Skeleton
In the remote JVM, each remote object may have a corresponding skeleton. The skeleton is responsible for dispatching the call to the actual remote object implementation.
And a skeleton I regard as a first implementation - something that satisfies the calling convention, performs a partial operation, and completes satisfactorily.
Form Oracle
Related videos on Youtube
program-o-steve
I love to write code. When i am not writing code , i am anxious to do so ! Anyway if am anxious, typing code is anxiolytic. Learning ruby these days.
Updated on February 13, 2022Comments
-
program-o-steve over 2 years
What does stub do on the server side ? And what is a skeleton ?
This is a diagram from wikipedia. I installed stub both on the server machine and the client machine. I understand that stub helps in the networking on the client side but what does stub do on the server side ?
Also in the above figure what does skeleton mean ?
-
program-o-steve over 12 yearsIs it that stub on the server machine is known as skeleton ? The same stub that is on the client machine ?
-
Matjaz Muhic over 12 yearsSkeleton is just a stub on the server side. I think. It's been a long time since I used RMI in college... :)
-
program-o-steve over 12 yearshow it is different from the stub on the client machine ?
-
Matjaz Muhic over 12 yearsThe difference is exactly what I described in my answer: Stub is responsible for marshalling (converting) the calls to java objects to a network-level "calls" and the skeleton does the same but in reverse order. It unmarshalls (converts back) the network-level "calls" to the java class calls.
-
program-o-steve over 12 yearswhen i kept the same .class files on the server and the client how do they act different ? Can you please explain
-
user207421 over 7 yearsThe stub is created once when the remote object is exported, not every time it is used as a parameter or return value. Your bullet points are therefore also out of order. 'After that, the stub is no longer needed in the client machine' is also incorrect, and your use of 'server' and 'client' is merely confusing when you are also talking about both parameters and return values.
-
user207421 over 7 yearsSkeleton code is not dummy code, and neither of them is pseudocode.
-
user207421 almost 7 yearsThe registry doesn't keep a pointer to anything. It keeps the stub. You mentioned
ss1
before defining it, but all this talk ofss0/1/2
is pointless. They are all copies of the same stub, as is 'the serialized version ofss0
'. There is no need to talk about the 'server-side stub' and the copies as being different things. They are all just 'the stub'. -
Theodore Norvell almost 7 yearsss2 was a typo. Fixed. Thanks. If you don't like the word "pointer", then "reference". The stubs in different VMs are different objects. They may represent the same thing, but they are different objects. The OP wanted to know why there is a stub object on the server's VM. This is what I am explaining. The two answers currently with the most upvotes (aMooly and Matjaz) don't address this part of the question.
-
Gustavo Alexandre almost 4 years>The skeleton is responsible for dispatching the call to the actual remote object implementation. Is this true, the skeleton is serverside, the stub is client-side. That way skeleton is meant to receive the client-side call (convert serialized object to real object)