JamesHuntJoelDominic..

Download Report

Transcript JamesHuntJoelDominic..

Remote Method Invocation
by James Hunt, Joel Dominic, and Adam Mcculloch
CONTENT
 What is RMI
 Why is it used
 How is it used
WHAT ARE OBJECTS
Encapsulation of…
 Data
• including pointers to other objects
 Methods
• used to manipulate the data
WHAT DOES RMI REALLY MEAN?
• RMI stands of Remote Method Invocation
• Essentially allows for a client to perform
operations on objects stored on a separate
networked machine
• Idea for RMI taken from RPC or Remote
Procedure Call
 Basically just the Procedural Programming approach to RMI
 Allows for procedures to be executed on a separately
networked machine
COMMON USES/INTERFACES FOR RMI
RMI is used in most distributed java applications
 Solely in java originally
 Has been ported to CORBA (Common Object Request
Broker Architecture)
• CORBA allows RMI to be used by non java languages
HOW IT WORKS
 A client machine will make a method call for
remote objects that reside on a server
 The server will then run that method on the
object
 Finally, the server will return the results of that
method to the client
PASSING OBJECT PARAMETERS
Serializing objects:
• In java (main language for RMI) objects must
use the serializable interface
 Everything within the object is encoded into a byte stream
 Non primitive objects being encoded must also implement
the serializable interface
STUBS and SKELETONS
Stubs:
• Resides on client machine
• Contains:
 Parent Object Reference
 Method call
 Parameters needed for execution
Skeletons:
• Resides only on the server
• Unwraps the stub to be run server side
• Translates stubs into actual object calls
Diagram courtesy of: http://www.cs.uiowa.edu/~slonnegr/wpj/RMI.pdf
Java code courtesy of: http://download.oracle.com/javase/tutorial/rmi/implementing.html
SUMMARY
 Client machine makes a method request on an object that
resides on the Server
 Client must pass in serialized objects as parameters and
then use Stubs and Skeletons to wrap and unwrap these
objects
 Server passes information back to the client through
serialized objects
SOURCES
• http://www.cs.uiowa.edu/~slonnegr/wpj/RMI.pdf
• http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136424.html
• http://download.oracle.com/javase/tutorial/rmi/index.html
• http://download.oracle.com/javase/tutorial/rmi/implementing.html
• http://www.daimi.au.dk/~mailund/scripting2005/lecture-notes/rmi.html
• http://notes.corewebprogramming.com/student/RMI.pdf
• http://infolab.stanford.edu/CHAIMS/Doc/Details/Protocols/rmi/rmi_description.html
• http://www.javacamp.org/moreclasses/rmi/rmi22.html
• http://www.sentex.net/~pkomisar/RMI.html
• http://java.sun.com/developer/technicalArticles/ALT/sockets/