notes10-RMI

notes10-RMI - Java-RMI Introduction The Java RMI is Java's...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Java-RMI Introduction The Java RMI is Java’s native scheme for creating and using remote objects. Java RMI provides the following elements: 1. Remote object implementations. 2. Client interfaces, or stubs, to remote objects. 3. A remote object registry for finding objects on the network. 4. A network protocol for communication between remote objects and their client (this protocol is JRMP, i.e. Java Remote Method Protocol). 5. A facility for automatically creating (activating) remote objects on-demand. Each of these elements (except the last one) has a Java interface defined for it in the java.rmi package and its subclasses. RMI is part of the core Java API and has been enhanced for JDK 1.2 (Java 2 platform) in recognition of the critical need for support for distributed objects in distributed-application development. With RMI, you can get a reference to an object that “lives” in a remote process on remote hosts and invoke methods on it as if it were a local object running within the same Java virtual machine as your code. Each remote object implements a remote interface that specifies which of its methods can be invoked by clients. Prior to RMI, a distributed application involved socket programming, where a raw communication channel was used to pass messages and data between two remote processes. The programmer needed to define a low-level message protocol and data transmission format between processes in the distributed application.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
With RMI, you can “export” an object as a remote object, so that other remote processes/agents can access it directly as a Java object. RMI handles all the underlying networking needed to make your remote method calls work. RMI is a Java-only distributed object scheme; the distributed objects in an RMI-based distributed application have to be implemented in Java. This could be a problem when interfacing with legacy applications. CORBA, on the other hand, is a language-independent distributed object scheme. It is however, more complex to work with than RMI. Advantages of RMI Since RMI is a Java native, integration of its remote object facilities into a Java application is seamless. You can use RMI-enabled objects as if they live in the local Java environment. RMI extends the internal garbage-collection mechanisms of the standard JVM to provide distributed garbage collection of remotely exported objects.
Background image of page 2
RMI is platform-independent (though not language- independent). RMI is easy to learn. You can migrate entire objects (i.e. class byte codes are portable) to a remote host via object serialization in RMI. This is not possible in CORBA. Your options, if you have a distributed application with heterogeneous components, some of which are written in Java and some that are not: You can use CORBA since it is supports language- independent object interfaces (the Java IDL API included in the Java 2 platform covers the Java interface to CORBA). You can use RMI, wrapping the non-Java code with
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

notes10-RMI - Java-RMI Introduction The Java RMI is Java's...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online