Java Reference
In-Depth Information
CHAPTER 11
Using Remote
Method Invocation
T he CDC is expressly for devices with always-on or nearly always-on connections to
the Internet. CDC devices offer great potential for network programming, because the
demands of limited resources are balanced by a reliable network connection. Java's support
for Remote Method Invocation (RMI) provides a programming model that is a welcome
alternative to the lightweight model provided by web services. (Ironically, the RMI model in
large part predates the move to web services, as it's based on the remote procedure call
semantics developed at Sun and popularized in a variety of remote computing initiatives.)
In this chapter, I first give you a whirlwind tour of the Java RMI facility as it is imple-
mented in the Java SE. After presenting you with the high-level architecture and
approach to Java RMI, I introduce the key Java RMI interfaces and show how those inter-
faces fit together to meet two key goals of many networked applications: remoting Java
computation, and remoting access to Java objects. Next I turn attention to JSR 66, the
Java RMI Optional Package (RMI OP) that defines the implementation of RMI available
on some CDC-enabled devices. After I show you what is available through the Java RMI
OP, I present an example to help cement the concepts you encounter in this chapter.
Understanding Java RMI
A key feature of the Java programming language is its ability to support distributed pro-
gramming—applications that run on separate hosts, passing objects back and forth—
through the Java RMI paradigm.
All distributed object-oriented applications need to perform three kinds of tasks:
Remote object discovery : Applications need mechanisms to discover references to
remote objects.
Remote communication : Applications running in different contexts on different
machines need to be able to communicate about the changing state of objects.
Remote behavior definition : Applications must also be able to communicate about
the definitions from which those objects are derived.
273
 
Search WWH ::




Custom Search