Distributed Systems. Session 4: RPCs (Remote Method Invocation) Java RMI. Christos Kloukinas Dept. of Computing City University London. Outline. Motivation and Introduction to Java RMI Conceptual Framework RMI Details Example Implementation Summary. 0 Motivation.
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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Session 4: RPCs (Remote Method Invocation) Java RMI.
Dept. of Computing
City University London
Application and services
RMI and RPC
Marshalling and external data Representation
TCP and UDP
Hello World Program
Define yourremote interface
Run the Stub Compiler
Start RMI registry
Start Server objects
To write an RMI application proceed as follows:
“localhost” or run Java like this: java helloSrv `hostname`
// Server wishes to make itself available to others: SomeSRVC service = ...; // remote object for serviceRegistry registry = LocateRegistry.getRegistry(); registry.bind("I Serve", service); // The client wishes to make requests of the above service:Registry registry = LocateRegistry.getRegistry("foo.services.com"); SomeSRVC service = (SomeSRVC)registry.lookup("I Serve"); service.requestService(...);
The Remote Method Invocation (RMI) is a Java system that can be used to easily develop distributed object-based applications.
RMI, which makes extensive use of object serialization, can be expressed by the following formula:
RMI = Sockets + Object Serialization + Some Utilities
The utilities are the RMI registry and the compiler to generate stubs and skeletons.
If you are familiar with RMI, you would know that developing distributed object-based applications in RMI is much simpler than using sockets.
So why bother with sockets and object serialization then?
CORBA & COMPARISON WITH RMI