Remote Method Invocation - PowerPoint PPT Presentation

About This Presentation
Title:

Remote Method Invocation

Description:

The RMI is not a totally new idea in the distributed computing area many of ... To prevent the system from executing a harmful code the security manager must be ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 12
Provided by: georgic
Category:

less

Transcript and Presenter's Notes

Title: Remote Method Invocation


1
Remote Method Invocation
eCL
Course materials
Georgi Cholakov, georgi.cholakov_at_ecl.pu.acad.bg
Emil Doychev, emil.doychev_at_ecl.pu.acad.bg
University of Plovdiv Paisii Hilendarski,
e-Commerce Laboratory
2
In order to begin
Necessary knowledge
  • Basic Java knowledge, including
  • Building hierarchies of interfaces and classes
  • Passing parameters by value and by reference
  • Object serialization

Desirable knowledge
  • Experience with streams in Java
  • Naming Services

Not necessary knowledge
  • Details of network protocols, such as TCP/IP
  • Sockets

3
Overview
The necessity of distributed computing
  • Proven scientifically and practically
  • RMI gives opportunity to distribute the work
    among different processes (machines)

The Remote Method Invocation idea
  • The RMI is not a totally new idea in the
    distributed computing area many of its features
    come from CORBA (Remote Procedure Call,
    generation of stubs and skeletons, naming
    service)
  • RMI designed only for Java, pure Java-to-Java
    solution

4
What is RMI?
Definition
Remote Method Invocation designed to provide
distributed object development tool for Java
applications, running in different JVMs
eventually on different hosts.
Existing systems differences with RMI
  • CORBA
  • Remote Procedure Call in C/C

5
How RMI works
RMI Registry
Java Client
Network
Stub
Skeleton
Client JVM
Remote JVM
6
A close look at the details
Remote interface
  • An object can be considered as a remote object if
    it implements a remote interface. A remote
    interface is a Java interface that
  • extends java.rmi.Remote interface
  • is public
  • each method throws java.rmi.RemoteException.

Remote object
  • There are several rules for implementing class to
    obey
  • the class must extend UnicastRemoteObject
  • must contain a non-argument constructor
  • must provide an implementation for each remote
    method.

7
A close look at the details
Stub and Skeleton
  • The Stub/Skeleton layer is the interface between
    applications and the RMI system.
  • The stub is responsible for
  • Initiating a call to the remote object and
    sending arguments (if any) to the stream
  • Receive the result or exception.
  • The skeleton is responsible for
  • Receiving arguments from the stream
  • Doing the actual method call to the remote
    object
  • Sending the result back to the stream.

8
A close look at the details
RMI Registry
  • The RMI Registry is
  • a process, running on the remote virtual machine
    and makes it possible for client applications to
    locate and obtain references to remote objects
  • it provides the naming service for registering
    and retrieving remote object reference by name.

Java client
The Java client application has only one RMI
specific task to look up the remote object and
get the reference.
9
A close look at the details
Security
In order the client to interact with objects in
different virtual machine, the specific
permissions must be granted. These permissions
are stored in a policy file, named java.policy.
To prevent the system from executing a harmful
code the security manager must be installed, such
as RMISecurityManager. This class defines a
default security policy for RMI applications.
10
Summary of steps to implement RMI
To implement a RMI server and client, we have to
  • develop the remote interface, extending
    java.rmi.Remote and declare all methods, that
    will be visible for remote invocation, each
    method throwing the java.rmi.RemoteException
  • realize the class of the remote object,
    implementing the remote interface, and extend the
    class UnicastRemoteObject. We must not forget in
    the main() method to install security manager,
    then create an instance of the object and bind it
    to the registry
  • generate stub and skeleton

When these tasks are done, we can
  • start the naming service (RMI Registry) and run
    the remote object
  • develop the client application, which must
    obtain reference to the remote object in the
    naming service. Now the remote methods will be
    available as they are locale.

11
Conclusion
The Remote Method Invocation is a lightweight and
simple approach to the distributed computing in
comparison with other existing systems. We may
consider RMI as an extension of Java, because
its contained in Java. RMI has simplicity and
great performance for lightweight distributed
systems.
Write a Comment
User Comments (0)
About PowerShow.com