Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.

Similar presentations


Presentation on theme: "1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation."— Presentation transcript:

1 1 RMI Russell Johnston Communications II

2 2 What is RMI? Remote Method Invocation

3 3 Overview Why use RMI? What does RMI do for you? What else can RMI do for you? How does RMI compare to RPC? How does RMI work? How do you implement RMI? Applications of RMI

4 4 Why use RMI? RMI makes IPC and Client/Server programming simpler RMI makes distributed and parallel computing simpler Platform independence

5 5 What does RMI do for you? Data marshalling and external representation Transparent parameter passing When combined with JNDI, true location transparency When combined with CORBA, language independence and connectivity to legacy systems

6 6 What else can RMI do for you? Distributed garbage collection Security (authentication support) Activation (transparent object disk swapping / memory paging)

7 7 How does RMI compare to RPC? Object oriented vs. procedure oriented Registry vs. portmapper URL vs. program number Rmic vs. rpcgen Interface class vs. *.x file Serialization vs. XDR CORBA vs. Versioning

8 8 How does RMI work? Architecture Data marshalling and external representation Transparent parameter passing

9 9 Architecture Client (interface) Stub Network Skeleton Remote object

10 10 Data marshalling and external representation Object serialization  Primitive data types are automatically serializable  Objects implement java.lang.Serializable  Transient  Size  Resources that need to be reconstructed  Insecure data  Recursion Java data representation is portable by design

11 11 RMI Transparent Parameter Passing Copy-by-value (serialization) Copy-by-reference (reference to another remote object)

12 12 How do you implement RMI? Create an interface which extends java.rmi.Remote. Every method in the interface must throw java.rmi.RemoteException Create the remote object which implements the interface and extends java.rmi.server.UnicastRemoteObj ect

13 13 Implementation (cont.) Generate the stub and skeleton via rmic. Create the server which will bind the RMI service the registry Create the client which will get the remote object via Naming.lookup() and manipulate the remote object via the interface

14 14 Implementation (cont.) Run  Start the registry via rmiregistry  Start the server  Start the client

15 15 Applications of RMI EJB  EJB Object  Home Object Parallel distributed GA


Download ppt "1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation."

Similar presentations


Ads by Google