Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii.
Published byModified over 4 years ago
Presentation on theme: "Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii."— Presentation transcript:
Company LOGO Remote Method Invocation Georgi Cholakov, firstname.lastname@example.org Emil Doychev, email@example.com University of Plovdiv “Paisii Hilendarski”, e-Commerce Laboratory eCL Course materials
In order to begin… Necessary knowledge Desirable knowledge Basic Java knowledge, including Building hierarchies of interfaces and classes Passing parameters by value and by reference Object serialization Experience with streams in Java Naming Services Not necessary knowledge Details of network protocols, such as TCP/IP Sockets
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
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++
How RMI works Java Client Stub RMI Registry Remote object Skeleton Network Client JVMRemote JVM
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.
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.
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.
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.
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.
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.