Академический Документы
Профессиональный Документы
Культура Документы
Sapna Saxena
Lecturer, CSE Department
Chitkara University
Remote Procedure Call
The concept of performing computations over a
network of machines had been around long before
the concept of Java itself.
A popular way to distribute work over a network is
through RPC (or Remote Procedure Call).
MACHINE A MACHINE B
line 1…. begin remote proc()
line 2…. ll R e mote
Ca
call proc()
r o c e dure … remote proc logic
call remote Proc() P
----
line n…. ----
---- Retur return value
---- n value end remote proc()
-line n+n
In fact, the calling machine does not even have to know the
procedure is actually performed remotely on another machine.
In the figure, we can see how a remote call is actually placed “on
the network wire” by marshalling code.
On the remote machine, corresponding un marshalling code will
un package the data and make the actual call (logically) on the
remote machine.
Remote
Method
Invocation
Introduction to RMI
Java provide different mechanisms, such as RMI,
Corba, EJB. Etc. that allow one to invoke a method
on an object that exists in another address space.
The other address space could be on the same
machine or a different one.
The primary goal for the network designer is 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 would
work in a distributed (multiple JVM) computing
environment.
Remote Method Invocation
Java’s RMI feature enables a program in one Java
Virtual Machine (JVM) to make a method calls on a
remote server machine within another JVM.
The Remote Method Invocation features give Java
programmers the ability to distribute computing
across a networked environment.
RMI internally use sockets over TCP/IP.
Object-oriented design requires every task to be
executed by the object most appropriate for that task.
RMI takes this concept one step further by allowing a
task to be performed on the machine most
appropriate for the task.
RMI Communication
NETWORK
request for
Machine A remote service Machine B Machine C
Marshalled
Return
Return Method Invocation Value Method Invocation
Value on Client on Server
Stub Skeleton
CalculatorImplement_Stub.java CalculatorImplement_Skel.java
Submit Tasks
Client CalculatorServer
Return Results