In this trail you've seen how to use Java IDL, the CORBA-compliant remote object technology, to develop a simple client-server application, as well as two differnt ways to locate remote CORBA objects. Java IDL and Java RMI are the two remote-object technologies provided with the Java Development Kit software.
This summary compares features of Java RMI and Java IDL to help make it easier to choose between the two. It also provides pointers to other sources of information on CORBA, IDL, and the OMG.
Deciding Whether to Use RMI or IDLBecause they have similar purposes, RMI and Java IDL have some similar features and capabilities--as well as some differences. This section summarizes several of these similarities and differences to help you understand these technologies better and make choosing between them easier.
- 100% Pure Java vs. Support for Legacy Applications
- Java RMI is a 100% Pure Java solution for remote objects, providing all the advantages of Java's "write once, run anywhere" abilities. Servers and clients developed with Java RMI can be deployed anywhere on a network on any platform that supports the Java runtime environment.
Java IDL, in contrast, is based on an industry standard for remotely invoking objects written in any supported programming language. As a result, Java IDL provides a way to connect to "legacy" applications that still serve vital business needs but that were written in languages other than Java.
- Communication Protocols
- Java RMI and Java IDL currently use different protocols for communicating between objects on different platforms. Java IDL uses the CORBA-standard Internet Inter-Orb Protocol (IIOP), the protocol shared by all CORBA-compliant Object Request Brokers. Together with IDL, IIOP enables objects residing on diverse platforms and written in diverse languages to interact in standard ways. Java RMI currently uses the Java Remote Messaging Protocol (JRMP)--a protocol developed specifically for Java's remote object capabilities.
For the future, Sun and IBM have announced plans to enable RMI to use the IIOP protocol to communicate with CORBA-compliant remote objects.
- Objects by Reference, Objects by Value
- In Java IDL, a client interacts with a remote object by reference. That is, the client never gets an actual copy of the server object in its own runtime environment. Instead, the client uses stubs in the local runtime to manipulate the server object residing on the remote platform.
In contrast, RMI enables a client to interact with a remote object by reference, or to download it and manipulate it in the local runtime environment by value. This is because all objects in RMI are Java objects. RMI uses the object serialization capabilities of the Java language to transport objects from the server to the client. Java IDL, because it interacts with objects written in any language, can't take advantage of this "write once, run anywhere" feature of the Java programming language.
Note that future versions of the CORBA specification will include protocols for passing objects by value.
For More InformationJava IDL glossary gives definitions for new terms you may have encountered throughout the tutorial. You can read more background information and details in the Java IDL documentation found online: http://java.sun.com/products/jdk/idl/index.html.
Additional information on the OMG and CORBA standard are available from the OMG Web site at http://www.omg.org/. In particular, take a look at CORBA for Beginners at: http://www.omg.org/news/begin.htm.