1 / 11

Remote Method Invocation

Remote Method Invocation. eCL. Course materials. Georgi Cholakov, georgi.cholakov@ecl.pu.acad.bg Emil Doychev, emil.doychev@ecl.pu.acad.bg. University of Plovdiv “Paisii Hilendarski”, e-Commerce Laboratory. In order to begin…. Necessary knowledge. Basic Java knowledge, including

Télécharger la présentation

Remote Method Invocation

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. Remote Method Invocation eCL Course materials Georgi Cholakov, georgi.cholakov@ecl.pu.acad.bg Emil Doychev, emil.doychev@ecl.pu.acad.bg University of Plovdiv “Paisii Hilendarski”, e-Commerce Laboratory

  2. In order to begin… Necessary knowledge • Basic Java knowledge, including • Building hierarchies of interfaces and classes • Passing parameters by value and by reference • Object serialization Desirable knowledge • Experience with streams in Java • Naming Services Not necessary knowledge • Details of network protocols, such as TCP/IP • Sockets

  3. Overview The necessity of distributed computing • Proven scientifically and practically • RMI – gives opportunity to distribute the work among different processes (machines) The Remote Method Invocation idea • The RMI is not a totally new idea in the distributed computing area – many of its features come from CORBA (Remote Procedure Call, generation of stubs and skeletons, naming service) • RMI – designed only for Java, pure Java-to-Java solution

  4. What is RMI? Definition Remote Method Invocation – designed to provide distributed object development tool for Java applications, running in different JVMs eventually on different hosts. Existing systems – differences with RMI • CORBA • Remote Procedure Call in C/C++

  5. Remote object How RMI works RMI Registry Java Client Network Stub Skeleton Client JVM Remote JVM

  6. A close look at the details Remote interface • An object can be considered as a remote object if it implements a remote interface. A remote interface is a Java interface that: • extends java.rmi.Remote interface; • is public; • each method throws java.rmi.RemoteException. Remote object • There are several rules for implementing class to obey: • the class must extend UnicastRemoteObject; • must contain a non-argument constructor; • must provide an implementation for each remote method.

  7. A close look at the details Stub and Skeleton • The Stub/Skeleton layer is the interface between applications and the RMI system. • The stub is responsible for: • Initiating a call to the remote object and sending arguments (if any) to the stream; • Receive the result or exception. • The skeleton is responsible for: • Receiving arguments from the stream; • Doing the actual method call to the remote object; • Sending the result back to the stream.

  8. A close look at the details RMI Registry • The RMI Registry is: • a process, running on the remote virtual machine and makes it possible for client applications to locate and obtain references to remote objects; • it provides the naming service for registering and retrieving remote object reference by name. Java client The Java client application has only one RMI specific task – to look up the remote object and get the reference.

  9. A close look at the details Security In order the client to interact with objects in different virtual machine, the specific permissions must be granted. These permissions are stored in a policy file, named java.policy. To prevent the system from executing a harmful code the security manager must be installed, such as RMISecurityManager. This class defines a default security policy for RMI applications.

  10. Summary of steps to implement RMI To implement a RMI server and client, we have to: • develop the remote interface, extending java.rmi.Remote and declare all methods, that will be visible for remote invocation, each method throwing the java.rmi.RemoteException; • realize the class of the remote object, implementing the remote interface, and extend the class UnicastRemoteObject. We must not forget in the main() method to install security manager, then create an instance of the object and bind it to the registry; • generate stub and skeleton; When these tasks are done, we can: • start the naming service (RMI Registry) and run the remote object; • develop the client application, which must obtain reference to the remote object in the naming service. Now the remote methods will be available as they are locale.

  11. Conclusion The Remote Method Invocation is a lightweight and simple approach to the distributed computing in comparison with other existing systems. We may consider RMI as an extension of Java, because it’s contained in Java. RMI has simplicity and great performance for lightweight distributed systems.

More Related