Stub - Definition,Features - RMI

Q.  Which is an object, acts as a gateway for the client side, all the outgoing requests are routed through it and it resides at the client side and represents the remote object?

- Published on 19 Oct 15

a. Stub
b. Skeleton
c. Both A & B
d. None of the above

ANSWER: Stub
 

    Discussion

  • Nirja Shah   -Posted on 14 Dec 15
    - RMI uses stub and skeleton object for communication with the remote object.
    - An object whose method can be invoked from another JVM is known as a remote object

    Stub
    - It is an object that acts as a gateway for the client side.
    - All the outgoing requests are routed through it.
    - It resides at the client side and represents the remote object.
    - When the caller invokes method on the stub object, it does the following tasks:
    1. It initiates a connection with remote Virtual Machine (JVM),
    2. It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
    3. It waits for the result
    4. It reads (unmarshals) the return value or exception, and
    5. It finally, returns the value to the caller.

    Skeleton
    - It is an object that acts as a gateway for the server side object.
    - All the incoming requests are routed through it.
    - When the skeleton receives the incoming request, it does the following tasks:
    1. It reads the parameter for the remote method
    2. It invokes the method on the actual remote object, and
    3. It writes and transmits (marshals) the result to the caller.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)