This chapter examines the Java Remote Method Invocation (RMI) API -- Java’s native scheme for creating and using remote objects. Java RMI provides the following elements:
Remote object implementations
Client interfaces, or stubs, to remote objects
A remote object registry for finding objects on the network
A facility for automatically creating (activating) remote objects on-demand
A network protocol for communication between remote objects and their client
Each of these elements (except the last
one) has a Java interface defined for it within the
java.rmi package and its subpackages, which
comprise the RMI API. Using these interfaces, you can develop remote
objects and the clients that use them to create a distributed
application that resides on hosts across the network.
RMI is the distributed object system that is built into the core Java environment. You can think of RMI as a built-in facility for Java that allows you to interact with objects that are actually running in Java virtual machines on remote hosts on the network. With RMI (and other distributed object APIs we discuss in this book), you can get a reference to an object that “lives” in a remote process and invokes methods on it as if it were a local object running within the same virtual machine as your code (hence the name, “Remote Method Invocation API”).
Another way to characterize RMI (and other remote object schemes) is in terms of the granularity of the distribution ...