Distributed Computing Remote Method Invocation (RMI)

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 16

DISTRIBUTED COMPUTING Remote Method Invocation (RMI)

The Java RMI Architecture

The RMI system consists of three layers:

The application layer sits on top of the RMI system

A remote method invocation from a client to a remote server object travels down through the layers of the RMI system to the client-side transport, then up through the server-side transport to the server.

The Stub/Skeleton Layer


The stub/skeleton layer is the interface between the application layer and the rest of the RMI system.
This layer does not deal with specifics of any transport, but transmits data to the remote reference layer via the abstraction of marshal streams. Marshal streams employ a mechanism called object serialization which enables Java objects to be transmitted between address spaces. Objects transmitted using the object serialization system are passed by copy to the remote address space, unless they are remote objects, in which case they are passed by reference.

A client-side stub is responsible for:


A stub for a remote object is the client-side proxy for the remote object. Such a stub implements all the interfaces that are supported by the remote object implementation. A client-side stub is responsible for: Initiating a call to the remote object (by calling the remote reference layer). Marshalling arguments to a marshal stream (obtained from the remote reference layer).

Informing the remote reference layer that the call should be invoked.
Un-marshalling the return value or exception from a marshal stream. Informing the remote reference layer that the call is complete.

A skeleton for a remote object is a server-side entity that contains a method which dispatches calls to the actual remote object implementation. The skeleton is responsible for: Un-marshalling arguments from the marshal stream. Making the up-call to the actual remote object implementation. Marshalling the return value of the call or an exception (if one occurred) onto the marshal stream.

The Remote Reference Layer


The remote reference layer is responsible for carrying out the invocation semantics: The remote reference layer is responsible for determining whether the server is a single object or is a replicated object requiring communications with multiple locations. Local method invocations are executed exactly once This cannot always be the case for remote method invocation (At-Least-Once, At-Most-Once, etc.) Request-reply protocols, such as RMI, can be implemented in different ways to provide different delivery guarantees These choices lead to a variety of possible semantics for the reliability of remote invocations

Also handled by the remote reference layer are the reference semantics for the server.
The remote reference layer, for example, abstracts the different ways of referring to objects that are implemented in

(a) Servers that are always running on some machine, and


(b) Servers that are run only when some method invocation is made on them (activation).

A primary goal for the RMI designers was to allow programmers to develop distributed Java programs with the same syntax and semantics used for non-distributed programs. To do this, they had to carefully map how Java classes and objects work in a single Java Virtual Machine (JVM) to a new model of how classes and objects would work in a distributed (multiple JVM) computing environment.

The Transport Layer


In general, the transport layer of the RMI system is responsible for: Setting up connections to remote address spaces.

Managing connections.
Monitoring connection "liveness" Listening for incoming calls. Maintaining a table of remote objects that reside in the address space. Setting up a connection for an incoming call.

The transport for the RMI system consists of four basic abstractions: An endpoint is the abstraction used to denote an address space or Java virtual machine. In the implementation, an endpoint can be mapped to its transport. That is, given an endpoint, a specific transport instance can be obtained.

A channel is the abstraction for a conduit between two address spaces. It is responsible for managing connections between the local address space and the remote address space for which it is a channel.

A connection is the abstraction for transferring data (performing input/output).

The transport abstraction manages channels:


Each channel is a virtual connection between two address spaces. The transport abstraction is also responsible for accepting calls on incoming connections to the address space, setting up a connection object for the call, and dispatching to higher layers in the system.

Java RMI (Remote Method Invocation)

In general, a class that implements a remote interface should do the following: Declare the remote interfaces being implemented Define the constructor for each remote object

Provide an implementation for each remote method in the remote interfaces

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy