Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote.

Similar presentations


Presentation on theme: "Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote."— Presentation transcript:

1

2 Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote interfaces which are pure Java interfaces that declare the methods of the remote object. A method invocation on a remote object has the same syntax as a method invocation on a local object.

3 Java Distributed Object Model A reference to a remote object can be passed as an argument or returned as a result in any local or remote method invocation (RMI) Natural Java mechanisms can be used for type- checking and casting of remote objects Clients of remote objects interact with remote interfaces If a remote object reference is passed, the receiver will get a reference to the same remote object The semantics of some of the methods defined by class objects are specialized for remote objects

4 Remote Method Invocation (RMI) – Three Layered Architecture Stub/Skeleton – Client-side stubs (proxies) and server-side skeletons Remote Reference Layer - Reference/Invocation behavior (e.g.. unicast, multicast) Transport – Connection setup and management and remote object tracking RMI is a layer on top of the JVM which leverages the Java system’s built-in garbage collection, security and class-loading mechanisms The application layer sits on top of RMI

5 Remote Method Invocation (RMI) – Three Layered Architecture

6 The RMI Layers Abstract Invocation Calls, hiding low-level Transport Mechanism

7 Remote Method Invocation (RMI) RMI enables the programmer to create distributed Java-to-Java, Java-to-C through JNI, applications, in which the methods of remote Java objects can be invoked from other Java virtual machines, possibly on different hosts. A Java program can make a call on a remote object once it obtains a reference to the remote object, either by looking up the remote object in the bootstrap naming service provided by RMI or by receiving the reference as an argument or a return value. A client can call a remote object in a server, and that server can also be a client of other remote objects. RMI uses Object Serialization to marshal and unmarshal parameters and does not truncate types, supporting true object- oriented polymorphism.

8 Example of Distributed program using Java RMI The distributed example uses an applet to make a remote method call to the server from which it was downloaded to invoke the method. When the applet runs, the return is invoked and displayed on the client applet. There are four source files for the remote server and applet: The Java remote interface The Java remote object (server) which implements the remote interface The Java applet that remotely invokes the server’s method The HTML code for the web page that references the applet

9 Remote Method Invocation (RMI) Summary With RMI, you can access the methods of remote objects On the server (JWS), you can run the RMI-Registry program A Java application that registers one or more objects with the RMI Registry On the client, you run a java application that accesses the methods of the objects of the application running on the server. Run the RMI rmic command on the file and create the client, client stub, server and server stub

10 Reference Multi-Tier Architecture for TI with Fault- Tolerance and Automated Replication Paul C. Barr Technical Manager Software Technology & Information Services White paper on RMI http://java.sun.com/marketing/collateral/javarmi.html


Download ppt "Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote."

Similar presentations


Ads by Google