Java Reference
In-Depth Information
Note .NET has a similar and competing technology called .NET remoting.
This is a good time to define some terms. When we use the term server in RMI program-
ming scenarios, we are referring to a remote object that has methods that can be invoked from
another JVM. A client is the object that invokes the remotely accessible methods of the server.
An RMI distributed object system provides remote objects that can be invoked by clients. Com-
munication between a client and a remote object is two-way. A client must be able to locate
and communicate with remote objects, invoke their methods, and receive their return values.
RMI specifically enables Java objects on different machines to communicate with each
other. One of the motivations behind RMI is for developers to interact with remote Java
objects as if they were local objects. The actual location of the object is transparent to the
developer. Network transparency is a very appealing feature, because it abstracts the complex-
ities involved in distributed object systems so that they behave as if they were local object
systems. So in an RMI system, the client runs locally, while the rest of the system runs on a dif-
ferent machine. These types of systems are often referred to as distributed object systems.
Figure 6-5 illustrates this type of system.
Note An alternative to sockets and RMI is Remote Procedure Call (RPC). RPC is language- and processor-
independent, assumes that parameters are network representations of simple data types such as ints and
chars, and can be run on almost any platform. RMI is only processor-independent, assumes an object-
oriented framework, and requires the use of Java.
In addition to RPC, CORBA and Simple Object Access Protocol (SOAP) are other technologies that allow
processor and language independence between different platforms. But because RMI assumes the use of
Java, many of the tedious protocol-level tasks have been built into RMI, leaving the developer with more
time to worry about application logic. Java's RMI is very good for Java systems, since it can assume that a
JVM will be present on both sides of the network connection. For these reasons, RMI is preferable to RPC
and CORBA in distributed object systems built entirely with Java. However, as a scandalous side note,
CORBA systems tend to perform better than RMI systems, mainly because they can be written in C or C++.
Closely related to RMI is RMI-IIOP, which stands for Java Remote Method Invocation Run Over Internet Inter-
Orb Protocol. RMI-IIOP was coproduced by Sun and IBM in order to achieve interoperability between
CORBA-compliant applications and Java. Using the Java development language, you can create the Interface
Definition Language (IDL) that will work with CORBA applications written in languages such as C++. The
rmic compiler supports the option -iiop , which will produce the IDL files.
Search WWH ::




Custom Search