Java Reference
In-Depth Information
Network support : Although the full RMI implementation supports automatic HTTP
tunneling through firewalls, as you'll see in the section “Seeing What's Provided by
the Java RMI Optional Package” later in this chapter, the Java RMI OP does not.
Thus, to support Java RMI on Java ME devices, your network security policy requires
additional thought over that required when simply deploying a web service.
Despite these limitations, Java RMI may be a good fit when developing your appli-
cation, especially if your situation meets one of two criteria. First, clearly, if your
application infrastructure already uses RMI, you can best integrate with it by continuing
to use RMI throughout your development. This is especially true for some segments of
the telecommunication consumer electronics marketplace, where middleware solutions
to constrained television set-top boxes are common. Second, if you are developing an
application with strong remote computation requirements, RMI provides a better layer
of abstraction for expressing programs about remoting computation through agents
than a traditional web service.
Introducing the Java RMI Interfaces
The key to understanding Java RMI is understanding the concept of interfaces. As you
already know, an interface is a contract: it makes a promise that a particular object will
carry out particular functions (the methods of the class), but it doesn't say how it will
carry out those functions. In other words, an interface separates the definition of behavior
from the implementation of behavior . This is key, because RMI uses this concept through-
out its implementation; your remote objects are defined in terms of their interfaces, and
their implementation (that is, their ability to operate as remote objects) occurs behind
your program's back.
The Java RMI interfaces are defined in the java.rmi package hierarchy. This hierarchy
defines one interface, three classes, and a bunch of exceptions:
The java.rmi.Remote interface : Specifies the intent of an interface destined for
remote execution
The java.rmi.MarshalledObject class : Abstracts a byte stream with the serialized
representation of an object
The java.rmi.Naming class : Provides the interface to storing and obtaining refer-
ences to remote objects in a remote object registry
The java.rmi.RMISecurityManager class : Defines a default security manager used
when downloading code from a remote server
Exceptions such as java.rmi.RemoteException : Occur when dealing with errors that
can occur in a distributed environment
 
Search WWH ::




Custom Search