0% found this document useful (0 votes)
60 views20 pages

Remote Method Invocation

A REMOTE METHOD INVOCATION is a form of the RPC that is available on other systems. Instead of creating objects on local machines you create some of the objects on other machines and you communicate with those objects as you would normally would with local objects.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views20 pages

Remote Method Invocation

A REMOTE METHOD INVOCATION is a form of the RPC that is available on other systems. Instead of creating objects on local machines you create some of the objects on other machines and you communicate with those objects as you would normally would with local objects.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

REMOTE METHOD

INVOCATION
AGENDA
• Introduction
• What is RMI
• The Goals of RMI
• The RMI system architecture
• How RMI works
• Distributed garbage collection
• Security
• Conclusion
Introduction

• Java’s RMI is an alternative to low level


sockets. A remote method invocation is a
form of the RPC that is available on other
systems. Instead of creating objects on
local machines you create some of the
objects on other machines and you
communicate with those objects as you
would normally would with local objects
WHAT IS RMI
• RMI is a core package of the JDK 1.1 and above that
can be used to develop distributed application.

• It enables software developers to write distributed


applications in which the methods of remote objects can
be invoked from other JVMs
The Goals of RMI
• Support seamless remote invocations on objects in different java
virtual machines.
• Support callbacks from servers to clients.
• Integrate the distributed object model into the Java language in a
natural way while retaining most of the Java language’s object
semantics.
• Make differences between the distributed object model and the local
java object model apparent.
• Make writing reliable distributed applications as simple as possible.
• Preserve the safety provided by the java sun real time environment.
The RMI system architecture
• The RMI system is built in three layers

• The stub/skeleton layer

• The remote reference layer

• The transport layer


RMI Layers
Java Virtual Machine Java Virtual Machine
Client Remote
Object Object

Stub Skeleton

Remote Reference Layer Remote Reference Layer


TCP
Transport Layer Transport Layer
Copyright © 1997 Alex Chaffee
Remote Objects & Interfaces
• Remote Objects
– Live on server
– Accessed as if they were local
• Interface
– The interface of a module specifies accessible
procedures and variables that can be
accessed from other modules
Registries
• Name and look up remote objects
• Servers can register their objects
• Clients can find server objects and obtain
a remote reference
• A registry is a running process on a host
machine
Remote References and Interfaces
• Remote References
– Refer to remote objects
– Invoked on client exactly like local object
references
• Remote Interfaces
– Declare exposed methods
– Implemented on client
– Like a proxy for the remote object
Stubs and Skeletons
• Stub
– lives on client represents an interface
– pretends to be remote object
– Initiates a connection with remote VM containing the
remote object.
– Marshals the parameters to the remote VM.
– Unmarshals the return value or exception returned
• Skeleton
– lives on server
– receives requests from stub
– talks to true remote object
– delivers response to stub
Remote Interfaces and Stubs

Remote Interface

implements implements

Remote Object
Client Stub Skeleton
(Server)

Copyright © 1997 Alex Chaffee


Remote Reference Layer
• Local pointer’s not good enough
• Figures out which remote object is being
referenced.
• Could span multiple virtual machines
• Communicates via TCP/IP

Copyright © 1997 Alex Chaffee


Transport Layer
• Deals with communications
• Connection management
• Dispatching messages between stub and
skeleton
• Distributed Garbage Collection
• Sits on top of java.net

Copyright © 1997 Alex Chaffee


RMI System Architecture
Client Virtual Machine Server Virtual Machine
Client Remote
Object

Stub Skeleton
Server

“HOME”
Registry
CopyrightVirtual Machine
© 1997 Alex Chaffee
RMI Flow
1. Server Creates Remote Object
Client Virtual Machine Server Virtual Machine
2. Server Registers Remote Object
Client Remote
Object
1

Stub Skeleton
Server

“HOME”
Registry
CopyrightVirtual Machine
© 1997 Alex Chaffee
RMI Flow
Client Virtual Machine Server Virtual Machine
Client Remote
3. Client requests object from Registry
Object
4. Registry returns remote reference
(and stub gets created)

Stub Skeleton
Server
3 4

“HOME”
Registry
CopyrightVirtual Machine
© 1997 Alex Chaffee
RMI Flow
Client Virtual Machine Server Virtual Machine
Client Remote
Object
5 7

6
Stub Skeleton
Server

5. Client invokes stub method


6. Stub talks to skeleton
7. Skeleton invokes remote object
method “Fred”
Registry
CopyrightVirtual Machine
© 1997 Alex Chaffee

You might also like