1 / 15

RMI

RMI. Russell Johnston Communications II. What is RMI?. Remote Method Invocation. 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. Why use RMI?.

vidor
Télécharger la présentation

RMI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RMI Russell Johnston Communications II

  2. What is RMI? • Remote Method Invocation

  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. Why use RMI? • RMI makes IPC and Client/Server programming simpler • RMI makes distributed and parallel computing simpler • Platform independence

  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. What else can RMI do for you? • Distributed garbage collection • Security (authentication support) • Activation (transparent object disk swapping / memory paging)

  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. How does RMI work? • Architecture • Data marshalling and external representation • Transparent parameter passing

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

  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. RMI Transparent Parameter Passing • Copy-by-value (serialization) • Copy-by-reference (reference to another remote object)

  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.UnicastRemoteObject

  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. Implementation (cont.) • Run • Start the registry via rmiregistry • Start the server • Start the client

  15. Applications of RMI • EJB • EJB Object • Home Object • Parallel distributed GA

More Related