java remote method java remote method invocation rmi
play

Java Remote Method Java Remote Method Invocation (RMI) Invocation - PowerPoint PPT Presentation

Java Remote Method Java Remote Method Invocation (RMI) Invocation (RMI) Viraj Bhat ( Viraj Bhat (virajb@caip.rutgers.edu virajb@caip.rutgers.edu) ) Cristina Schmidt (cristins@caip.rutgerts.edu) Cristina Schmidt (cristins@caip.rutgerts.edu)


  1. Java Remote Method Java Remote Method Invocation (RMI) Invocation (RMI) Viraj Bhat ( Viraj Bhat (virajb@caip.rutgers.edu virajb@caip.rutgers.edu) ) Cristina Schmidt (cristins@caip.rutgerts.edu) Cristina Schmidt (cristins@caip.rutgerts.edu) ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  2. Distributed Systems Distributed Systems � a collection of independent computers that a collection of independent computers that � appears to its users as a single coherent appears to its users as a single coherent system system ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  3. Models of Distribution Models of Distribution � Message passing Message passing � � Distributed objects Distributed objects � � Event Event- -based architectures based architectures � � Space Space- -based paradigms based paradigms � ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  4. Distributed Object Model Distributed Object Model � Views a distributed system as a series of Views a distributed system as a series of � interacting objects interacting objects � Based on some underlying message Based on some underlying message � passing protocol invisible to the passing protocol invisible to the programmer programmer � Three main technologies: Three main technologies: RMI RMI , CORBA , CORBA � and DCOM and DCOM ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  5. Distributed Object Computing Distributed Object Computing � Enable any object in the local system to directly interact Enable any object in the local system to directly interact � with an object on a remote host with an object on a remote host � Goals: Goals: � � Let any object reside anywhere in the network, and allow an Let any object reside anywhere in the network, and allow an � application to interact with these objects in the same way as application to interact with these objects in the same way as they do with a local object. they do with a local object. � Provide the ability to construct an object on one host and Provide the ability to construct an object on one host and � transmit it to another host. transmit it to another host. � Enable an agent on one host to create an object on another Enable an agent on one host to create an object on another � host. host. ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  6. What Is RMI? What Is RMI? � A mechanism that allows the invocation of A mechanism that allows the invocation of � a method that exists in another address a method that exists in another address space space � Java Java- -to to- -Java Java only only � � Client Client- -Server Protocol Server Protocol � � High High- -level API level API � � Transparent Transparent � � Lightweight Lightweight � ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  7. Examples of Use Examples of Use � Database access Database access � � Computations Computations � � Any custom protocol Any custom protocol � � Not Not for standard protocols (HTTP, FTP, for standard protocols (HTTP, FTP, � etc.) etc.) ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  8. Related Technologies Related Technologies � RPC RPC � (“Remote Procedure Calls”) (“Remote Procedure Calls”) � Developed by Sun Developed by Sun � � Platform Platform- -specific specific � � CORBA CORBA � (“Common Object Request Broker Architecture”) (“Common Object Request Broker Architecture”) � Developed by OMG Developed by OMG � � Access to non Access to non- -Java objects (as well as Java) Java objects (as well as Java) � � DCOM DCOM � (“Distributed Common Object Model”) (“Distributed Common Object Model”) � Developed by Microsoft Developed by Microsoft � � Access to Win32 objects Access to Win32 objects � � LDAP LDAP � (“Lightweight Directory Access Protocol”) (“Lightweight Directory Access Protocol”) � Finding resources on a network Finding resources on a network � ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  9. Part I: RMI Concepts Part I: RMI Concepts ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  10. RMI RMI � Client Client – – the process that invokes a method on a the process that invokes a method on a � remote object remote object � Server Server – – the process that owns the remote the process that owns the remote � object object � Object Registry Object Registry – – a name server that relates a name server that relates � objects with names objects with names � Objects are registered with the Object Registry, under Objects are registered with the Object Registry, under � a unique name. a unique name. � The Object Registry is used to obtain access to The Object Registry is used to obtain access to � remote objects, using their names. remote objects, using their names. ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  11. Remote Objects (Diagram) Remote Objects (Diagram) Java Virtual Machine Java Virtual Machine Client Remote TCP Object Object Client Server ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  12. RMI Layers 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 ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  13. RMI Architecture in the OSI model RMI Architecture in the OSI model Application Layer User Application Presentation Layer Stub Skeleton Session Layer Remote Reference Layer Transport Layer TCP Network Layer IP Data-link layer Physical Layer Hardware Interface Network ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  14. Java Virtual Machine Java Virtual Machine Client Remote Object Object Remote Objects Remote Objects Stub Skeleton Remote Reference Layer Remote Reference Layer TCP Transport Layer Transport Layer Server Client � Remote Objects Remote Objects � � Live on server Live on server � � Accessed as if they were local Accessed as if they were local � ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  15. Java Virtual Machine Java Virtual Machine Client Remote Object Object Stub Skeleton Stubs and Skeletons Stubs and Skeletons Remote Reference Layer Remote Reference Layer TCP Transport Layer Transport Layer Server Client � Stub Stub � � lives on client lives on client � � pretends to be remote object pretends to be remote object - - a proxy for the remote object a proxy for the remote object � � Skeleton Skeleton � � lives on server lives on server � � receives requests from stub, talks to the remote object and receives requests from stub, talks to the remote object and � delivers response to stub delivers response to stub � Stubs and skeletons are not written by the programmer! Stubs and skeletons are not written by the programmer! � They are generated by a special compiler “rmic” They are generated by a special compiler “rmic” ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

  16. Java Virtual Machine Java Virtual Machine Client Remote Object Object Stub Skeleton Stubs and Skeletons Stubs and Skeletons Remote Reference Layer Remote Reference Layer TCP Transport Layer Transport Layer Server Client � Stub Stub – – responsibilities responsibilities � � Initiate remote calls Initiate remote calls � � Marshals arguments to be sent Marshals arguments to be sent � � Informs the remote reference layer that a call Informs the remote reference layer that a call � should be invoked on the server should be invoked on the server � Unmarshals a return value (or exception) Unmarshals a return value (or exception) � � Informs the remote reference layer that the Informs the remote reference layer that the � call is complete call is complete ECE 451:Introduction to Parallel ECE 451:Introduction to Parallel 11/18/2003 11/18/2003 and Distributed Programming and Distributed Programming

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend